• 设为首页
  • 点击收藏
  • 手机版
    手机扫一扫访问
    迪恩网络手机版
  • 关注官方公众号
    微信扫一扫关注
    公众号

TypeScript object.computed函数代码示例

原作者: [db:作者] 来自: [db:来源] 收藏 邀请

本文整理汇总了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;未经允许,请勿转载。


鲜花

握手

雷人

路过

鸡蛋
该文章已有0人参与评论

请发表评论

全部评论

专题导读
上一篇:
TypeScript container.Registry类代码示例发布时间:2022-05-28
下一篇:
TypeScript mighty-http-adapter.RestAdapter类代码示例发布时间:2022-05-28
热门推荐
热门话题
阅读排行榜

扫描微信二维码

查看手机版网站

随时了解更新最新资讯

139-2527-9053

在线客服(服务时间 9:00~18:00)

在线QQ客服
地址:深圳市南山区西丽大学城创智工业园
电邮:jeky_zhao#qq.com
移动电话:139-2527-9053

Powered by 互联科技 X3.4© 2001-2213 极客世界.|Sitemap