在coffeescript中的函数末尾添加函数调用

Aus*_*ree 2 coffeescript ember.js

关于如何将其写为coffeescript的任何想法?

Person = Ember.Object.extend({
  // these will be supplied by `create`
  firstName: null,
  lastName: null,

  fullName: function() {
    var firstName = this.get('firstName');
    var lastName = this.get('lastName');

   return firstName + ' ' + lastName;
  }.property('firstName', 'lastName')
});
Run Code Online (Sandbox Code Playgroud)

}.property对代码的一部分特别感兴趣.我无法弄清楚如何在coffeescript中写这个.

Mic*_*ert 6

就个人而言,我喜欢围绕我的功能:

Person = Ember.Object.extend(
  firstName: null
  lastName: null
  fullName: (->
    firstName = @get("firstName")
    lastName = @get("lastName")
    firstName + " " + lastName
  ).property("firstName", "lastName")
)
Run Code Online (Sandbox Code Playgroud)

我的脑袋可以更好地解析这个;-)