尝试将vue-select
添加到我的vue应用程序,我有以下代码:
<v-select :options="options" label="country" :reduce="country => country.meta.code" v-on:input="set"/>
选项看起来如下:
[
{
country: 'canada',
meta: {
code: 'ca',
tags: ['sky', 'plain'],
provinces: ['foo']
}
},
{
country: 'New York',
meta: {
code: 'ze',
tags: ['water', 'boat'],
provinces: ['bar']
}
}
]
现在我想通过元数据搜索选项,以便例如输入字符串sky
,选项canada
被选中。
这是可能的吗?如果,怎么做?
我现在找到了解决方案。可以使用熔断器自定义过滤器:
https://vue-select.org/guide/filtering.html filtering-with-fuse-js