ElementPlus 穿梭框支持批量穿梭

按照目前的方案试了**el-virtual-transfer**: ,这个库对于vue3+ts的代码无效。

方案:魔改原生的transfer组件,把原来的el-checkbox包一层虚拟滚动列表

废话不多说:实现的效果如下:

批量勾选3000个设备到左边做到不卡顿

关键代码:

复制代码
      <ElCheckboxGroup
        v-show="!hasNoMatch && data.length > 0"
        v-model="checked"
        :class="{ 'is-filterable': filterable }"
        class="el-transfer-panel__list"
        style="display: flex; flex-direction: column; height: 100%; overflow: hidden"
      >
        <VirtualList
          v-if="virtualScroll && filteredData.length > 0"
          style="flex: 1; height: 400px; overflow-y: auto"
          :data-key="propsAlias.key"
          :data-sources="filteredData"
          :data-component="TransferCheckboxItem"
          :estimate-size="40"
        />
        <template v-else>
          <ElCheckbox
            v-for="item in filteredData"
            :key="item[propsAlias.key]"
            :class="ns.be('panel', 'item')"
            :value="item[propsAlias.key]"
            :disabled="item[propsAlias.disabled]"
            :validate-event="false"
          >
            <OptionContent :option="optionRender?.(item)" />
          </ElCheckbox>
        </template>
      </ElCheckboxGroup>


import VirtualList from "vue3-virtual-scroll-list";

<customTransfer
        ref="transferRef"
        v-model="selectedDeviceKeys"
        :data="transferData"
        filterable
        :filter-method="filterMethod"
        filter-placeholder="请输入关键字进行模糊搜索"
        :titles="transferTitles"
        :button-texts="['解绑', '绑定']"
        class="full-height-transfer"
        :virtual-scroll="true"
/>

项目地址:https://github.com/EmilyHOC/el-transfer-pannel-bigData/tree/main

相关推荐
苦藤新鸡1 天前
27.合并有序链表,串葫芦
前端·javascript·链表
_OP_CHEN1 天前
【前端开发之HTML】(四)HTML 标签进阶:表格、表单、布局全掌握,从新手到实战高手!
前端·javascript·css·html·html5·网页开发·html标签
Alair‎1 天前
前端开发之环境配置
前端·react.js
谢尔登1 天前
Vue3底层原理——keep-alive
javascript·vue.js·ecmascript
Deca~1 天前
VueVirtualLazyTree-支持懒加载的虚拟树
前端·javascript·vue.js
2501_944526421 天前
Flutter for OpenHarmony 万能游戏库App实战 - 主题切换实现
android·开发语言·javascript·python·flutter·游戏·django
爱上妖精的尾巴1 天前
7-11 WPS JS宏 对象的属性值为函数的写法与用法
前端·javascript·wps·js宏·jsa
zuozewei1 天前
零基础 | 使用LangChain框架实现ReAct Agent
前端·react.js·langchain
坠入暮云间x1 天前
React Native for OpenHarmony开发环境搭建指南(一)
前端·react native·开源
爱上妖精的尾巴1 天前
7-12 WPS JS宏 this、return用构造函数自定义类-1:对象内部函数,外部调用的写法
前端·javascript·wps·js宏·jsa