【发布时间】:2019-08-25 16:55:22
【问题描述】:
我正在从一个返回存储对象数组的计算方法中填充一个下拉列表。然后在 vue-select 中,我将其作为options 传递,并在下拉列表中显示option.address。这按预期工作,但是当单击下拉选项时,该框不显示该值 - 它只是保持空白。
computed: {
storeLocationsArray: function() {
let arr = [];
this.storeLocations.forEach((location,index) => {
arr.push({id: index, address: location.address})
})
return arr;
}
}
<v-select
v-model="selectedPickupLocation"
:options="storeLocationsArray"
>
<template class="single-option" slot="option" slot-scope="option">
{{option.address}}
</template>
</v-select>
【问题讨论】:
-
你的应用会抛出警告 ~ "[vue-select warn]: 标签键 "option.label" 在选项对象中不存在"。你应该read the documentation
标签: vue.js vuejs2 vue-component vue-select