zoukankan      html  css  js  c++  java
  • pinyinEngine使用

    <el-form-item label="系统名称">
          <el-select
            v-model="searchForm['lngtoproductid']"
            clearable
            filterable
            :filter-method="filterFn"
            placeholder="请选择"
            style="200px"
            @focus="focusEvent"
          >
            <el-option
              v-for="item in optionList"
              :key="item.lngproductid"
              :label="item.strproductname"
              :value="item.lngproductid"
            />
          </el-select>
        </el-form-item>
     
    <script>
    const PinyinEngine = require('pinyin-engine')
    export default {
      name: 'ExternalBookSetFilterTool',
      data() {
        return {
          pinyinEngine: null,
          // 下拉框
          optionList: [

          ],
        }
      },
      methods: {
     getStrProductNameFn() {
          getStrProductNameFn(0, 315).then(res => {
            if (res.code === 20000) {
              this.optionList = res.data
              this.pinyinEngine = new PinyinEngine(this.optionList, ['strproductname'])
            }
          })
        },
        filterFn(val) {
          this.optionList = this.pinyinEngine.query(val)
        },
        focusEvent(e) {
          if (!e.target.value) {
            this.optionList = this.pinyinEngine.query('')
          }
        }
      }
    }
    </script>
  • 相关阅读:
    Linux中的DHCP服务
    写出发帖数最多的前几条记录
    nginx和php-fpm调用方式
    redi集群测试
    Redis 3.2.1集群搭建
    linux系统centOS7下搭建redis集群中ruby版本过低问题的解决方法
    nginx与php-fpm通信的两种方式
    Linux安装mongodb总结
    php高并发
    thinkphp5报错
  • 原文地址:https://www.cnblogs.com/hellofangfang/p/13839967.html
Copyright © 2011-2022 走看看