el-select ドロップダウン ボックスはページング データを処理し、ボトムアウトしてさらにロードします。

1. カスタム命令を宣言します。

directives: {
    'loadmore': {
        inserted(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();
                }
            });
        }
    }
},

2. カスタム命令 v-loadmore を使用します。

<el-select filterable v-model="form.standardDevice" placeholder="请选择" clearable v-loadmore="loadMore" @change="handleChange">
   <el-option v-for="item in deviceList" :key="item.deviceId" :label="item.deviceName" :value="item.serialNumber"></el-option>
   <el-option v-if="selectLoading" v-loading="selectLoading" value=""></el-option>
</el-select>

3. データをロードするリクエストを送信します。

//滚动条滚动到底部
loadMore(){
    //页数加一
    this.pageNum ++ 
    //发送网络请求
    this.getDeviceList()
},

参考: el-select は一番下までスクロールしてさらに読み込みます (ページ内のデータを読み込む)_el-select はページの一番下までスクロールします_Tiandao は頑張った人に報酬を与えます_Lu のブログ - CSDN ブログ

おすすめ

転載: blog.csdn.net/lq313131/article/details/131854820