【发布时间】:2023-04-11 07:05:01
【问题描述】:
假设我们的选项数组包含这样的对象
{
id: 1,
name: "Wisconsin",
attr: {
color: "red"
}
}
所以有了淘汰赛绑定,我们可以写这样的东西,
<select data-bind="
options:availableStates,
optionsText:'name',
optionsValue:'id',
value:selectedStateId">
</select>
但是,如果我想要 optionsValue = attr.color,则值为空
【问题讨论】: