zoukankan      html  css  js  c++  java
  • [element-ui] 多列表实现+自定义过滤 el-select

    自定义多列表,自定义过滤

     <el-select size="mini"  v-model="form.code" filterable :filter-method='filterMethod' clearable placeholder="请选择">
        <el-option v-for="item in options" :key="item.dictValue" :label="item.dictLabel" :value="item.dictValue">
             <template>
               <el-row type="flex">
                 <div style="padding-right:20px">{{item.dictValue}}</div>
                 <div>{{item.dictLabel}}</div>
               </el-row>
             </template>
        </el-option>
    </el-select>

    过滤函数

            filterMethod(query) {
                if (query == '') {
                    this.options= this.list
                }
                else {
                    let result = []
                    this.list.forEach(item => {
                        if (item.dictValue.includes(query)) result.push(item)
                    })
                    this.options= result
                }
            },
  • 相关阅读:
    Java多线程、并发
    Java I/O系统
    Java注解
    Arthas(Java诊断工具)
    Java泛型
    Java内部类
    libpcap使用
    python文件服务器
    设计模式
    protobuf
  • 原文地址:https://www.cnblogs.com/lv77/p/14865244.html
Copyright © 2011-2022 走看看