vue 组件

vue Ant Design Select 选择框输入搜索已有数

2021-09-16  本文已影响0人  生爱_存在
<a-select v-model="queryParam.sourceId" placeholder="请选择" :filterOption="optionInput" showSearch>
  <a-select-option v-for="(item,index) in sourceOptions" :key="index" :value="item.id">{{ item.source_name }}</a-select-option>
</a-select>

 mixins: [optionInputSearch],
// 选择框输入搜索已有数据
const optionInputSearch = {
    methods: {
        optionInput(val, opt) {
            let componentOptions = opt.componentOptions.children || opt[0].children;
            // 循环知道最后一层
            while (componentOptions[0].children && componentOptions[0].children.length > 0) {
                componentOptions = componentOptions[0].children;
            }
            return componentOptions[0].text.toLowerCase().indexOf(val) >= 0;
        }
    }
}

export {
    optionInputSearch,
}

vue + Ant Design 表格多选 mixin
vue 富文本图片上传处理

上一篇 下一篇

猜你喜欢

热点阅读