Vue自定义指令el-select下拉触发事件

 <el-select
     v-model="form.equipName"
     placeholder="请选择"
     v-el-select-loadmore="loadmore"//自定义绑定
     @change="selectChange"
 >
//自定义指令
 directives: {
        'el-select-loadmore': {
            bind(el, binding) {
                const SELECTWRAP_DOM = el.querySelector('.el-select-dropdown .el-select-dropdown__wrap');
                SELECTWRAP_DOM.addEventListener('scroll', function () {
                    const condition = this.scrollHeight - this.scrollTop <= this.clientHeight;
                    if (condition) {
                        binding.value();
                    }
                });
            }
        }
 loadmore() {
            console.log('触底');
        },

你可能感兴趣的:(前端,vue.js,前端框架)