vue el-select 下拉数据过多 打开慢 过滤数据

:filter-method="filterMethod" 添加 搜索绑定方法


    
   

 filterMethod(query) { // ICD出院诊断搜索过滤
                    //query是输入的关键字
                    if (query == '') {
                        this.changeIcd = icd.slice(0, 100) //过滤未选择时只显示100条
                    } else {
                        let result = [] //存储符合条件的下拉选项
                        this.icd.forEach(val => {
                            if (val.label.indexOf(query) != -1) result.push(val)
                        })
                        this.changeIcd = result.slice(0, 100) //只取前100个
                    }
                },
data:function(){
changeIcd: [],
}
 getSelect() {
                    axios.post('/', {
                            'subscript': 'gender,document_type,fee_source,policy_status,in_hospital_type,advance_type,judge,close_reason,qa_template,quality_project,shift_over_type,caller_identity,liyou',
                            'other': 'nationality,doctor,all_users,icd,project_id'
                        })
                        .then(function(response) {
                            var array = ['gender', 'document_type', 'fee_source', 'policy_status', 'in_hospital_type', 'close_reason', 'advance_type', 'judge', 'qa_template', 'quality_project', 'shift_over_type', 'caller_identity', 'liyou', 'nationality', 'doctor', 'all_users', 'icd'];
                            for (i in array) {
                                that[array[i]] = response.data.data[array[i]];
                            }

                            //保留原数据  另赋值数据
                            that.changeIcd = that.icd
//截取100
                            that.changeHospital_id = that.hospital_id.slice(0, 100)



                            that.qa_template = response.data.data['project_id'];
                        })
                        .catch(function(error) {});
                    axios.post('/', {})
                        .then(function(response) {
                            that.qa_first_level = response.data.data.first_level;
                            that.qa_second_level = response.data.data.second_level;
                        })
                        .catch(function(error) {});
                },

你可能感兴趣的:(vue el-select 下拉数据过多 打开慢 过滤数据)