我是淘汰赛的新手。我的要求是将自定义控件放置在使用“with”绑定的 div 中。下面是我正在使用的代码,
<div id="test" data-bind="with:testTemp">
-------- I have placed my custom control here ---------
--------- I am binding value to this custom control using "value" binding----
</div>
在脚本中,
function ViewModel() {
this.testTemp= ko.observable();
this.testTemp({
price : 6.6
});
}
现在值 6.6 已绑定到自定义控件,但该控件似乎无法正常工作。自定义控件不过是编辑器百分比 texbox,我无法增加/减少值。它似乎仅在我使用“with”绑定绑定 div 时发生。在父 div 中没有“with”绑定的情况下工作正常。所以,谁能告诉我上面的代码出了什么问题。为什么我的自定义控件无法使用“with”绑定与 div 一起使用。我需要在编码中添加任何内容吗?
感谢您的帮助。
提前致谢