0
说我有一个选择框如Knockoutjs - 如何预选第一个选项中选择下拉
<div data-bind='visible: someProp'>
<select class="selectSubWidgets" data-bind='options: subWidgets,optionsText: "Name", optionsValue : "Name", optionsCaption: "[Select a Widget]",attr: {name: "Widgets[" + $parent.widgets.indexOf($data) + "].Name"}, value: selectedSubWidget'></select>
</div>
如果在此选择的项目数量仅为1 - 目前我躲在这个下拉(工作),但我也希望确保单个项目被选中(隐藏时)(因此第一个值在表单过帐中被绑定)。有没有办法表达这种绑定?
谢谢!