- 使用Select的filterable
- 选中下拉中的任意一项
- 显示的结果值的前后有很多的空格
<Select
v-model="value"
filterable
>
<Option
v-for="(item, index) in list"
:key="index"
:value="item.value"
>
{{ item.name }}
</Option>
</Select>
<Select
v-model="value"
filterable
>
<Option
v-for="(item, index) in list"
:key="index"
:value="item.value"
>
{{ item.name }}
</Option>
</Select>
用filterable这个属性需要写方法吗?为什么我按照你这样的方式写,它报
TypeError: Cannot read property 'key' of undefined,我设置的key和value都是一个字段,这样写它会报上述错误,我的可选数组里面只有username这个字段。大神,求解答。
导致原因:
解决办法: