Binding 聚合物1.0数据绑定不工作

Binding 聚合物1.0数据绑定不工作,binding,polymer,Binding,Polymer,我有以下聚合物元素: 调用someMethod后,navigator.currentStep的值未更新 <dom-module id="m"> <template> Navigator step = <span>{{navigator.currentStep}}</span> </template> </dom-module> Polymer({ is: 'm', read

我有以下聚合物元素:

调用someMethod后,navigator.currentStep的值未更新

<dom-module id="m">
  <template>
    Navigator step = <span>{{navigator.currentStep}}</span>
  </template>
</dom-module>


Polymer({
        is: 'm',
        ready: function() {
          this.navigator = new Navigator(1);
          console.log(this.navigator.currentStep);  // 1
        },
        someMethod: function() {
          this.navigator.next();
          console.log(this.navigator.currentStep);   // 2
}
});

导航器步骤={{Navigator.currentStep}
聚合物({
是‘m’,
就绪:函数(){
this.navigator=新的navigator(1);
console.log(this.navigator.currentStep);//1
},
someMethod:function(){
this.navigator.next();
console.log(this.navigator.currentStep);//2
}
});
输出总是

导航步骤=1

但是下面的工作

<dom-module id="m">
  <template>
    Navigator step = <span>{{currentStep}}</span>
  </template>
</dom-module>


Polymer({
        is: 'm',
        ready: function() {
          this.navigator = new Navigator(1);
          this.currentStep = this.navigator.currentStep;   // 1
        },
        someMethod: function() {
          this.navigator.next();
          this.currentStep = this.navigator.currentStep;   // 2
}
});

导航器步骤={currentStep}
聚合物({
是‘m’,
就绪:函数(){
this.navigator=新的navigator(1);
this.currentStep=this.navigator.currentStep;//1
},
someMethod:function(){
this.navigator.next();
this.currentStep=this.navigator.currentStep;//2
}
});
调用
this.notifyPath('navigator.currentStep',this.navigator.currentStep)

有时命令式代码需要直接更改对象的子属性。由于我们避免使用更复杂的观察机制,如Object.observe或dirty checking,以实现最常见用例的最佳启动和运行时性能,因此直接更改对象的子属性需要用户的合作

具体而言,Polymer提供了两个API,允许向系统通知此类更改:
notifyPath(path,value)
set(path,value)
,其中path是标识路径(相对于主机元素)的字符串