本文整理汇总了TypeScript中aurelia-framework.computedFrom函数的典型用法代码示例。如果您正苦于以下问题:TypeScript computedFrom函数的具体用法?TypeScript computedFrom怎么用?TypeScript computedFrom使用的例子?那么恭喜您, 这里精选的函数代码示例或许可以为您提供帮助。
在下文中一共展示了computedFrom函数的10个代码示例,这些例子默认根据受欢迎程度排序。您可以为喜欢或者感觉有用的代码点赞,您的评价将有助于我们的系统推荐出更棒的TypeScript代码示例。
示例1: timeScaleData
@computedFrom('data', 'pump')
get timeScaleData(): chartjs.LinearChartData {
let lastPoint: DataPoint;
let currentArray = [];
let groups = new Array<DataPoint[]>();
for (var pt of this.data) {
if (lastPoint != null && lastPoint.pumpRunning != pt.pumpRunning) {
groups.push(currentArray);
currentArray = [];
}
currentArray.push(pt);
lastPoint = pt;
}
groups.push(currentArray);
return {
datasets: groups.map(arr => {
return {
data: arr.map(point => {
return {
x: point.timeStamp,
y: point.waterLevel
};
}),
borderColor: arr[0].pumpRunning ? 'Green' : 'Red'
};
})
};
}
开发者ID:NickSchweitzer,项目名称:SumpPumpMonitor,代码行数:31,代码来源:pumpdetail.ts
示例2: value
@computedFrom('job')
get value():string {
if(!Array.isArray(this.job.jobPhases)) return JobPhaseStatuses.NOT_STARTED;
const phase = this.job.jobPhases.find(p => p.phase._id === this.phase._id);
if(!phase) return JobPhaseStatuses.NOT_STARTED;
return phase.status;
}
开发者ID:Resounding,项目名称:Jobs-Web,代码行数:8,代码来源:table-cell.ts
示例3: title
@computedFrom('entity.id', 'entity.name')
get title() {
if (this.entity.id <= 0) {
return "New Application";
}
return `Application #${this.entity.id}`;
}
开发者ID:t0ms3n,项目名称:SoftwareManager,代码行数:8,代码来源:application.ts
示例4: style
@computedFrom("imageWidth", "imageHeight")
public get style(): string {
return `
min-height: ${this.maxHeight}px;
height: ${this.maxHeight}px;
`;
}
开发者ID:benlaan,项目名称:aurelia-bootstrap-plugin,代码行数:8,代码来源:bs-thumbnail.ts
示例5: items
@computedFrom("pageCount", "maxDisplayCount")
public get items(): Array<string> {
if (this._items != null && this.pageCount && this.maxDisplayCount)
return this._items;
this._items = this.calculateItems();
return this._items;
}
开发者ID:benlaan,项目名称:aurelia-bootstrap-plugin,代码行数:9,代码来源:bs-pagination.ts
示例6: body
/**
* @returns body, will lazy load from the web service if the body has not been
* loaded as of yet, note if it has not been loaded yet it will return null
* the first time.
*/
@computedFrom('_body')
get body() : string {
if(this._body == null){
this.client.fetch(`posts/${this.date}/${this._title}`)
.then(r => r.text())
.then(html => {
this._body = html
});
}
return this._body;
}
开发者ID:cjdibbs,项目名称:Blog,代码行数:17,代码来源:post.ts
示例7: timeScaleOptions
@computedFrom('data')
get timeScaleOptions(): chartjs.ChartOptions {
return {
scales: {
xAxes: [{
type: 'time',
time: {
minUnit: 'second',
tooltipFormat: "h:mm:ss a MM-DD-YYYY",
max: this.data[0].timeStamp,
min: this.data[this.data.length - 1].timeStamp
}
}]
},
legend: {
display: false
}
};
}
开发者ID:NickSchweitzer,项目名称:SumpPumpMonitor,代码行数:19,代码来源:pumpdetail.ts
示例8: fullName
@computedFrom("firstName", "lastName")
get fullName() { return this.firstName + " " + this.lastName; }
开发者ID:rajajhansi,项目名称:communityapp-aurelia-tswebpack,代码行数:2,代码来源:sponsors.ts
示例9: isSubTitleDisplayed
@computedFrom('showsubtitle')
get isSubTitleDisplayed(){
return this.showsubtitle == 'true';
}
开发者ID:richardnagle,项目名称:buildjs,代码行数:4,代码来源:team-banner.ts
示例10: hasAny
@computedFrom('mediaQueueViewModels')
get hasAny(): boolean {
return this.mediaQueueViewModels.length > 0;
}
开发者ID:sebthieti,项目名称:jogplayer-online,代码行数:4,代码来源:mediaQueue.ts
注:本文中的aurelia-framework.computedFrom函数示例整理自Github/MSDocs等源码及文档管理平台,相关代码片段筛选自各路编程大神贡献的开源项目,源码版权归原作者所有,传播和使用请参考对应项目的License;未经允许,请勿转载。 |
请发表评论