本文整理汇总了TypeScript中@ember-decorators/object.computed函数的典型用法代码示例。如果您正苦于以下问题:TypeScript computed函数的具体用法?TypeScript computed怎么用?TypeScript computed使用的例子?那么恭喜您, 这里精选的函数代码示例或许可以为您提供帮助。
在下文中一共展示了computed函数的10个代码示例,这些例子默认根据受欢迎程度排序。您可以为喜欢或者感觉有用的代码点赞,您的评价将有助于我们的系统推荐出更棒的TypeScript代码示例。
示例1: maxAvatarLength
/**
* Calculates the max number of avatars to render
* @type {ComputedProperty<number>}
* @memberof StackedAvatarsList
*/
@computed('avatars.length')
get maxAvatarLength(): number {
const {
avatars: { length }
} = this;
return length ? Math.min(length, defaultMavAvatarLength) : defaultMavAvatarLength;
}
开发者ID:alyiwang,项目名称:WhereHows,代码行数:12,代码来源:stacked-avatars-list.ts
示例2: showClearBtn
/**
* Computed property to check if there is any selection in the
* facet. If that is the case, a clear button will show up.
*/
@computed('selections')
get showClearBtn(): boolean {
const selections = this.selections || {};
return Object.keys(selections).reduce((willShowClearBtn: boolean, selectionKey: string) => {
return willShowClearBtn || selections[selectionKey];
}, false);
}
开发者ID:alyiwang,项目名称:WhereHows,代码行数:11,代码来源:search-facet.ts
示例3: bootstrapVersion
/**
* Returns the bootstrap version defined in the config, depending on this value the colums will be rendered differently
*/
@computed('config')
get bootstrapVersion() : number | undefined {
const config = this.config;
if(config.hasOwnProperty('ember-mist-components') && config['ember-mist-components'].hasOwnProperty('bootstrapVersion')) {
return config['ember-mist-components'].bootstrapVersion;
}
return;
}
开发者ID:pjcarly,项目名称:ember-mist-components,代码行数:12,代码来源:component.ts
示例4: records
/**
* Returns the Recently Viewed records currently in local storage, if nothing is found an empty array is returned
*/
@computed('storage.recentlyViewedRecords.[]')
get records() : RecentlyViewedRecord[] {
let oldRecentlyViewedRecords : RecentlyViewedRecord[] = this.storage.get('recentlyViewedRecords');
if(isBlank(oldRecentlyViewedRecords)) {
oldRecentlyViewedRecords = [];
}
return oldRecentlyViewedRecords;
}
开发者ID:pjcarly,项目名称:ember-mist-components,代码行数:12,代码来源:recently-viewed.ts
示例5: headers
/**
* We set the authorization header from the session service
*/
@computed('session.data.authenticated.access_token')
get headers() {
const headers: any = {};
const access_token = this.get('session.data.authenticated.access_token');
if(!isBlank(access_token)) {
headers['Authorization'] = `Bearer ${access_token}`;
}
return headers;
}
开发者ID:pjcarly,项目名称:ember-mist-components,代码行数:14,代码来源:ajax.ts
示例6: _styleString
@attribute('style')
@computed('style')
get _styleString() {
let s: JSONObject = this.get('style');
let sProps = [];
for (let i in s) {
if (s.hasOwnProperty(i)) {
sProps.push([i, s[i]]);
}
}
return sProps.map(x => `${x[0]}: ${x[1]}`).join('; ');
}
开发者ID:levanto-financial,项目名称:ember-oembed,代码行数:12,代码来源:ember-oembed.ts
示例7: outputDisplayRows
@computed('displayRows')
get outputDisplayRows() : any[] {
let outputDisplayRows = [];
if(!isBlank(this.displayRows)) {
for(let row of this.displayRows) {
let emptyRow = true;
for(let column of row.columns) {
column.component = replaceAll(column.component, 'input', 'output');
if(emptyRow) {
emptyRow = isBlank(this.address.get(column.field));
}
}
row.emptyRow = emptyRow;
outputDisplayRows.push(row);
}
}
return outputDisplayRows;
}
开发者ID:pjcarly,项目名称:ember-mist-components,代码行数:22,代码来源:component.ts
示例8: _contentUrl
@computed('providerUrl', 'src')
get _contentUrl() {
let params: any = this.get('providerParams');
let queryParams = JSON.parse(JSON.stringify(params)) || {};
queryParams.url = this.get('src');
let queryParamList = [];
for (let k in queryParams) {
if (queryParams.hasOwnProperty(k)) {
queryParamList.push([k, queryParams[k]]);
}
}
let queryString =
queryParamList.length > 0
? queryParamList
.map(x => {
return `${x[0]}=${x[1]}`;
})
.join('&')
: '';
const url: string = this.get('providerUrl') || '';
return `${url}?${queryString}`;
}
开发者ID:levanto-financial,项目名称:ember-oembed,代码行数:22,代码来源:ember-oembed.ts
示例9: items
@computed('value.@each')
get items() : MutableArray<string> {
return this.value ? this.value : A();
}
开发者ID:pjcarly,项目名称:ember-mist-components,代码行数:4,代码来源:component.ts
示例10: transform
/**
* transform SVG attribute for deacon SVG group - computed from x and y of supplied model
*/
@attribute @computed('model.x','model.y') get transform() : string {
return "translate(" + this.model.x + "," + this.model.y + ")";
}
开发者ID:lupestro,项目名称:deacon,代码行数:6,代码来源:deacon-figure.ts
注:本文中的@ember-decorators/object.computed函数示例由纯净天空整理自Github/MSDocs等源码及文档管理平台,相关代码片段筛选自各路编程大神贡献的开源项目,源码版权归原作者所有,传播和使用请参考对应项目的License;未经允许,请勿转载。 |
请发表评论