【发布时间】:2016-04-05 08:09:35
【问题描述】:
指南show a computed property 用反引号编写。我不确定它们是否有必要。
这样可以吗:
fullName: Ember.computed('firstName', 'lastName', function() {
return `${this.get('firstName')} ${this.get('lastName')}`;
})
改写成这样:
fullName: Ember.computed('firstName', 'lastName', function() {
return this.get('firstName') + ' ' + this.get('lastName');
})
?
对我来说,这不那么晦涩难懂。每种方法的优缺点是什么?
【问题讨论】:
标签: javascript ember.js ecmascript-6 computed-properties