1

应用控制器

isHotel_profile: function (){
    return this.get('currentPath') === 'hotel';
}.property('currentPath'),

零件

{{#step-controller hotelPage=isHotel_profile}} {{/step-controller}}

这是组件模板

{{#if hotelPage}}
 hotel page 
{{else}}
 not hotel page
{{/if}}

我想使用该属性作为有条件的我该如何实现

4

1 回答 1

2

您的代码是有效的,应该可以正常工作。

这是一个演示:http ://emberjs.jsbin.com/neste/1/edit?html,js,output

请注意,您可以像这样简化计算属性:

isHotel_profile: Ember.computed.equal('currentPath', 'hotel')
于 2015-06-28T21:49:17.090 回答