简体   繁体   English

Ember.js视图助手绑定的行为不符合预期?

[英]Ember.js view helper binding doesn't behave as expected?

I have a template with select input that controls which view should be currently rendered. 我有一个带有选择输入的模板,用于控制当前应呈现的视图。
To bind the selected value I'm using the handlebars view helper like this: 为了绑定选定的值,我使用了这样的把手视图助手:

// MyApp.MyViews = [MyApp.FirstView, MyApp.SecondView]
{{view Em.Select content="MyApp.MyViews" selection=selectedView}}
{{view selectedView}}

The problem is that the selected view area is not changing when the input selection is changed, the first selection gets rendered and further changes doesn't affect the view. 问题在于,当更改输入选择时,所选视图区域不会更改,第一个选择将被渲染,并且进一步的更改不会影响视图。
I've also tested this with the render helper but ended up with the same result. 我还使用了渲染帮助器对此进行了测试,但最终得到了相同的结果。
I've made a JSFiddle demonstrating my problem: http://jsfiddle.net/quzqqq2y/2/ . 我做了一个JSFiddle来演示我的问题: http : //jsfiddle.net/quzqqq2y/2/
I can force a rerender with an observer + view.rerender(), but that just feels wrong, is it a Ember bug or am I missing here something? 我可以用观察者+ view.rerender()强制重新渲染,但这感觉很不对,是Ember bug还是我在这里遗漏了什么?

模板不支持动态视图类型绑定,您将需要动态附加视图或刷新整个视图。

声明:本站的技术帖子网页,遵循CC BY-SA 4.0协议,如果您需要转载,请注明本站网址或者原文地址。任何问题请咨询:yoyou2525@163.com.

 
粤ICP备18138465号  © 2020-2024 STACKOOM.COM