【发布时间】:2018-05-22 07:42:44
【问题描述】:
我将 el-select 与 v-model 和具有不同数据的选项一起使用。
选择使用数据product.collection
对于选项选择使用数据options
如何从渲染数组 product.collection 中获取 v-model? 像这样 enter image description here
【问题讨论】:
标签: arrays vuejs2 element-ui
我将 el-select 与 v-model 和具有不同数据的选项一起使用。
选择使用数据product.collection
对于选项选择使用数据options
如何从渲染数组 product.collection 中获取 v-model? 像这样 enter image description here
【问题讨论】:
标签: arrays vuejs2 element-ui
根据您的 JSFiddle,v-model 位于 product.collection.name,但 product.collection 是一个对象数组。您可能应该更改为 product.collection 或指定像 product.collection[0].name 这样的索引。
查看http://element.eleme.io/#/en-US/component/select 上的代码示例。
这是一个使用对象作为 el-select 值的完整解决方案的 jsfiddle:https://jsfiddle.net/budgw/jsj9mnkx/1/
注意el-select 上的value-key 属性,这表示身份属性。此外,product.collection 值必须与option 值匹配。
【讨论】: