本文整理汇总了TypeScript中entcore-toolkit.Mix类的典型用法代码示例。如果您正苦于以下问题:TypeScript Mix类的具体用法?TypeScript Mix怎么用?TypeScript Mix使用的例子?那么, 这里精选的类代码示例或许可以为您提供帮助。
在下文中一共展示了Mix类的6个代码示例,这些例子默认根据受欢迎程度排序。您可以为喜欢或者感觉有用的代码点赞,您的评价将有助于系统推荐出更棒的TypeScript代码示例。
示例1: fromJSON
fromJSON(page) {
this.hasGrids = _.find(page.rows, (r) => _.find(r.cells, (c) => c.media.type === 'grid') !== undefined) !== undefined;
this.rows = new Rows(this, Mix.castArrayAs(Row, JSON.parse(JSON.stringify(page.rows)), this));
if (page.published === undefined) {
this.published = true;
}
}
示例2: all
set all(list: Cell[]) {
if(list.length && !(list[0] instanceof Cell)){
list = Mix.castArrayAs(Cell, list);
}
this._all = list;
}
示例3: fromJSON
fromJSON(data) {
if (data.media.type === 'grid') {
let source = Mix.castAs(Page, data.media.source);
this.media.source = source;
this.media.showEmbedder = false;
}
}
示例4: duplicate
duplicate() {
let data = JSON.parse(JSON.stringify(this));
let duplicate: Page = Mix.castAs(Page, data);
duplicate.website = this.website;
duplicate.title = this.title + ' (Copie)';
duplicate.setTitleLink();
this.website.pages.push(duplicate);
}
示例5: Row
scope.duplicate = () => {
let newRow = new Row(scope.row.page);
let newCell: Cell = Mix.castAs(Cell, JSON.parse(JSON.stringify(scope.cell)));
newCell.flash = true;
newCell.width = 12;
newRow.addCell(newCell);
let currentRow = scope.row as Row;
currentRow.page.rows.insertAfter(newRow, currentRow);
};
示例6: all
set all(list: Page[]) {
list = Mix.castArrayAs(Page, list);
this._all = list;
}