我從Ember 1.7升級到Ember 1.8.0-beta.2(增量升級,希望能達到最新的1.8 .0-beta.4沒有太大麻煩)。從{{view Ember.TextField}}過渡到{{input type =「text」}}
顯然,Ember.TextField是deprecated:
DEPRECATION: Resolved the view "Ember.TextField" on the global context. Pass a view name to be looked up on the container instead, such as {{view "select"}}. http://emberjs.com/guides/deprecations#toc_global-lookup-of-views-since-1-8
這是我最初的實現:
{{view Ember.TextField classNames="form-control" valueBinding="properties§name" id="name-id" placeholderTranslation="generic.name" required="true"}}
所以我試圖用(正如我與其他視圖完成):
{{view "textField" ...}}
不幸運:
Uncaught Error: Assertion Failed: textField must be a subclass of Ember.View, not
所以,現在看來它現在是component。於是我嘗試用:
{{input type="text" classNames="form-control" value=properties§name id="name-id" placeholderTranslation="generic.name" required="true"}}
而且它似乎工作,但我擔心,我也許做錯了什麼,因爲無論id
也不classNames
也不placeholderTranslation
都爲input
組件列爲supported properties。
所以在這裏我的問題:
- 我是正確的在做這個重構
{{view Ember.TextField}}
- >? - 未明確支持哪些屬性?他們似乎在我的情況下工作。這是一個過時的文檔問題,或...
- 是否有所有組件支持的通用屬性列表?我找不到任何。
我也注意到,在組件上的id屬性被自動設置爲組件的元素的ID。當我想傳入要在組件內部的元素上設置的id時,必須使用屬性'_id',而不是組件的wrapping元素的id – sunrize920 2014-10-08 17:34:53