本文整理匯總了TypeScript中adaptivecards.Container.addItem方法的典型用法代碼示例。如果您正苦於以下問題:TypeScript Container.addItem方法的具體用法?TypeScript Container.addItem怎麽用?TypeScript Container.addItem使用的例子?那麽, 這裏精選的方法代碼示例或許可以為您提供幫助。您也可以進一步了解該方法所在類adaptivecards.Container
的用法示例。
在下文中一共展示了Container.addItem方法的4個代碼示例,這些例子默認根據受歡迎程度排序。您可以為喜歡或者感覺有用的代碼點讚,您的評價將有助於係統推薦出更棒的TypeScript代碼示例。
示例1: addImage
addImage(url: string, container?: Container, selectAction?: CardAction) {
container = container || this.container;
const image = new Image();
image.url = url;
image.selectAction = selectAction && addCardAction(selectAction);
image.size = Size.Stretch;
container.addItem(image);
}
示例2: addTextBlock
addTextBlock(text: string, template: Partial<TextBlock>, container: Container = this.container) {
if (typeof text !== 'undefined') {
const textblock = new TextBlock();
// tslint:disable-next-line:forin
for (const prop in template) {
(textblock as any)[prop] = (template as any)[prop];
}
textblock.speak = text;
textblock.text = text;
container.addItem(textblock);
}
}
示例3: addColumnSet
addColumnSet(sizes: number[], container: Container = this.container) {
const columnSet = new ColumnSet();
container.addItem(columnSet);
return sizes.map(size => {
const column = new Column();
column.width = SizeAndUnit.parse(size);
columnSet.addColumn(column);
return column;
});
}
示例4:
cardElements.forEach(cardElement => container.addItem(cardElement));