我试图将我所有的 ember 组件转换为 OCTANE 版本。但我有一个更大的疑问。如何将observer
代码转换为 OCTANE 版本?例如,
parent.hbs
<Child @value={{this.value}} />
child.hbs
<div>{{this.newUpdate}}</div>
child.js
export default class ChildComponent extends Component {
/** Previous code: sample code only
valueUpdate: observer('value', function() {
this.newValue = this.value / 12 * 2;
})
*/
}
如何将观察者更新为辛烷值?有什么想法请...
注意:我尝试使用“@observer”,但它在组件内不起作用。