首页 > 移动平台 > 详细

vue - elemebt-admin 移动端select远程搜索软键盘无法弹出

时间:2021-03-29 20:32:54      阅读:31      评论:0      收藏:0      [点我收藏+]

试了网上大部分方法,体验感不好,即使软键盘出来。搜索需要再空格一下。于是转为input远程搜索 el-autocomplete

                <el-autocomplete v-model.trim="cidWords" :fetch-suggestions="searchCustomer" @select="selectCustomer" @clear="clearInput" clearable placeholder="客户名/简称" class="search-select left-btn min-left">
                    <template slot-scope="{ item }">
                        <div>{{ item.c_name }}({{ item.c_sname }})</div>
                    </template>
                </el-autocomplete>


        //搜索客户
        searchCustomer(query, cb) {
            if (query !== ‘‘) {
                this.cid = ‘‘;
                this.cidWords = ‘‘;
                this.customerss = [];
                getCustomer({ keyword: query, show: 1, comid: this.comid }).then((res) => {
                    const { list } = res;
                    this.customers = list;
                    if (this.customers.length == 0) {
                        this.customers.push({ cid: ‘‘, c_name: ‘暂无数据‘, c_sname: ‘无‘ });
                    }
                    cb(this.customers);
                });
            } else {
                this.customers = [];
                this.customers.push({ cid: ‘‘, c_name: ‘暂无数据‘, c_sname: ‘无‘ });
                cb(this.customers);
            }
        },
        //确定客户
        selectCustomer(data) {
            const { cid, c_name, c_sname } = data;
            if (cid != ‘‘) {
                this.cid = cid;
                this.cidWords = c_name + ‘(‘ + c_sname + ‘)‘;
            } else {
                this.cid = ‘‘;
                this.cidWords = ‘‘;
            }
        },
        //清空客户
        clearInput() {
            this.cid = ‘‘;
            this.cidWords = ‘‘;
            this.customers = [];
        },

vue - elemebt-admin 移动端select远程搜索软键盘无法弹出

原文:https://www.cnblogs.com/gggggggxin/p/14593527.html

(0)
(0)
   
举报
评论 一句话评论(0
关于我们 - 联系我们 - 留言反馈 - 联系我们:wmxa8@hotmail.com
© 2014 bubuko.com 版权所有
打开技术之扣,分享程序人生!