vxe-table 秒级渲染万级数据、极致流畅横向虚拟滚动与纵向虚拟滚动+自适应动态行高

news/2025/2/22 16:28:50/文章来源:https://www.cnblogs.com/qaz666/p/18567390

官网:https://vxetable.cn/

以前老版本不支持虚拟滚动动态行高,vxe-table 新版本发布后,已经可以支持虚拟滚动和动态行高了。如果需要同等行高,只需加上 show-overflow 就可以了,同等行高的渲染性能是最优的,动态行高支持的最大数量低非常多。
建议非必要的场景应该使用同等行高,特殊需求场景在使用动态行高。

<template><div><vxe-button @click="loadData(10000)">加载1w条</vxe-button><vxe-button @click="loadData(30000)">加载3w条</vxe-button><vxe-button @click="loadData(50000)">加载5w条</vxe-button><vxe-grid v-bind="gridOptions"></vxe-grid></div>
</template><script>
import { VxeUI } from 'vxe-table'export default {data () {const imgUrlCellRender = {name: 'VxeImage',props: {width: 36,height: 36}}const gridOptions = {border: true,loading: false,height: 800,columnConfig: {resizable: true},scrollX: {enabled: true,gt: 0},scrollY: {enabled: true,gt: 0},columns: [{ type: 'checkbox', width: 60 },{ title: '列0', field: 'col0', width: 100 },{ title: '列1', field: 'imgUrl', width: 80, cellRender: imgUrlCellRender },{ title: '列2', field: 'col2', width: 160 },{ title: '列3', field: 'col3', width: 200 },{ title: '列4', field: 'col4', width: 140 },{ title: '列5', field: 'col5', width: 300 },{ title: '列6', field: 'col6', width: 160 },{ title: '列7', field: 'col7', width: 120 },{ title: '列8', field: 'col8', width: 400 },{ title: '列9', field: 'col9', width: 160 },{ title: '列10', field: 'col10', width: 160 },{ title: '列11', field: 'col11', width: 180 },{ title: '列12', field: 'col12', width: 160 },{ title: '列13', field: 'col13', width: 80 },{ title: '列14', field: 'col14', width: 120 },{ title: '列15', field: 'col15', width: 360 },{ title: '列16', field: 'col16', width: 150 },{ title: '列17', field: 'col17', width: 380 },{ title: '列18', field: 'col18', width: 100 },{ title: '列19', field: 'col19', width: 290 },{ title: '列20', field: 'col20', width: 80 },{ title: '列21', field: 'col21', width: 100 },{ title: '列22', field: 'col22', width: 120 },{ title: '列23', field: 'col23', width: 270 },{ title: '列24', field: 'col24', width: 330 },{ title: '列25', field: 'col25', width: 460 },{ title: '列26', field: 'col26', width: 280 },{ title: '列27', field: 'col27', width: 220 },{ title: '列28', field: 'col28', width: 120 },{ title: '列29', field: 'col29', width: 180 },{ title: '列30', field: 'col30', width: 500 },{ title: '列31', field: 'col31', width: 600 },{ title: '列32', field: 'col32', width: 100 },{ title: '列33', field: 'col33', width: 490 },{ title: '列34', field: 'col34', width: 100 },{ title: '列35', field: 'col35', width: 150 },{ title: '列36', field: 'col36', width: 800 },{ title: '列37', field: 'col37', width: 400 },{ title: '列38', field: 'col38', width: 800 },{ title: '列39', field: 'col39', width: 360 },{ title: '列40', field: 'col40', width: 420 },{ title: '列41', field: 'col41', width: 100 },{ title: '列42', field: 'col42', width: 120 },{ title: '列43', field: 'col43', width: 280 },{ title: '列44', field: 'col44', width: 170 },{ title: '列45', field: 'col45', width: 370 },{ title: '列46', field: 'col46', width: 420 },{ title: '列47', field: 'col47', width: 170 },{ title: '列48', field: 'col48', width: 400 },{ title: '列49', field: 'col49', width: 220 },{ title: '列50', field: 'col50', width: 170 },{ title: '列51', field: 'col51', width: 160 },{ title: '列52', field: 'col52', width: 500 },{ title: '列53', field: 'col53', width: 280 },{ title: '列54', field: 'col54', width: 170 },{ title: '列55', field: 'col55', width: 370 },{ title: '列56', field: 'col56', width: 120 },{ title: '列57', field: 'col57', width: 170 },{ title: '列58', field: 'col58', width: 400 },{ title: '列59', field: 'col59', width: 220 },{ title: '列60', field: 'col60', width: 650 },{ title: '列61', field: 'col61', width: 600 },{ title: '列62', field: 'col62', width: 100 },{ title: '列63', field: 'col63', width: 490 },{ title: '列64', field: 'col64', width: 100 },{ title: '列65', field: 'col65', width: 150 },{ title: '列66', field: 'col66', width: 800 },{ title: '列67', field: 'col67', width: 400 },{ title: '列68', field: 'col68', width: 800 },{ title: '列69', field: 'col69', width: 360 },{ title: '列70', field: 'col70', width: 650 },{ title: '列71', field: 'col71', width: 600 },{ title: '列72', field: 'col72', width: 100 },{ title: '列73', field: 'col73', width: 490 },{ title: '列74', field: 'col74', width: 100 },{ title: '列75', field: 'col75', width: 150 },{ title: '列76', field: 'col76', width: 800 },{ title: '列77', field: 'col77', width: 400 },{ title: '列78', field: 'col78', width: 800 },{ title: '列79', field: 'col79', width: 360 },{ title: '列80', field: 'col80', width: 650 },{ title: '列81', field: 'col81', width: 600 },{ title: '列82', field: 'col82', width: 100 },{ title: '列83', field: 'col83', width: 490 },{ title: '列84', field: 'col84', width: 100 },{ title: '列85', field: 'col85', width: 150 },{ title: '列86', field: 'col86', width: 800 },{ title: '列87', field: 'col87', width: 400 },{ title: '列88', field: 'col88', width: 800 },{ title: '列89', field: 'col89', width: 360 },{ title: '列90', field: 'col90', width: 650 },{ title: '列91', field: 'col91', width: 600 },{ title: '列92', field: 'col92', width: 100 },{ title: '列93', field: 'col93', width: 490 },{ title: '列94', field: 'col94', width: 100 },{ title: '列95', field: 'col95', width: 150 },{ title: '列96', field: 'col96', width: 800 },{ title: '列97', field: 'col97', width: 400 },{ title: '列98', field: 'col98', width: 800 },{ title: '列99', field: 'col99', width: 360 },{ title: '列100', field: 'col100', width: 360 }],data: []}return {gridOptions,imgUrlCellRender}},methods: {// 模拟行数据loadData (rowSize) {this.gridOptions.loading = truesetTimeout(() => {const dataList = []for (let i = 0; i < rowSize; i++) {const item = {id: 10000 + i,imgUrl: i % 3 === 0 ? 'https://vxeui.com/resource/img/546.gif' : 'https://vxeui.com/resource/img/673.gif'}for (let j = 0; j < 100; j++) {if (i % 9 === 0) {item[`col${j}`] = `值_${i}_${j} 内容9内容9 内容9内容9内容9 内容9内容9内容9内容9 内容9内容9内容9内容9 内容9内容9内容9 内容9内容9`} else if (i % 8 === 0) {item[`col${j}`] = `值_${i}_${j} 内容8内容8内容8内容8`} else if (i % 7 === 0) {item[`col${j}`] = `值_${i}_${j} 内容7内容7`} else if (i % 6 === 0) {item[`col${j}`] = `值_${i}_${j} 内容6内容6内容6内容6内容6内容6内容6内容6`} else if (i % 5 === 0) {item[`col${j}`] = `值_${i}_${j} 内容5内容5内容5内容5内容5`} else if (i % 4 === 0) {item[`col${j}`] = `值_${i}_${j} 内容4内容4内容4内容4内容4内容4内容4内容4内容4内容4内容4内容4`} else {item[`col${j}`] = `值_${i}_${j}`}}dataList.push(item)}const startTime = Date.now()this.gridOptions.data = dataListthis.gridOptions.loading = falsethis.$nextTick(() => {VxeUI.modal.message({content: `加载时间 ${Date.now() - startTime} 毫秒`,status: 'success'})})}, 350)}},created () {this.loadData(200)}
}
</script>

本文来自互联网用户投稿,该文观点仅代表作者本人,不代表本站立场。本站仅提供信息存储空间服务,不拥有所有权,不承担相关法律责任。如若转载,请注明出处:http://www.hqwc.cn/news/840831.html

如若内容造成侵权/违法违规/事实不符,请联系编程知识网进行投诉反馈email:809451989@qq.com,一经查实,立即删除!

相关文章

C# 高效餐饮管理系统设计与实现

前言 推荐一个C#开发全面、高效的商用餐饮管理系统。该系统集成了餐饮业日常运营所需的各种功能,包括但不限于订单管理、库存控制、财务结算等,通过信息技术手段,帮助餐饮企业实现管理的自动化和智能化。 系统介绍 本系统设计的主要意义在于它能够切实有效地指导工作人员规范…

Docker:Docker搭建Jenkins并共用宿主机Docker部署服务(四)配置Jenkins用户与权限

前言 继续完成Jenkins权限配置管理,Jenkins的搭建与插件安装可以观看上一篇文章:https://www.cnblogs.com/nhdlb/p/18561435 授权策略 首页 -> 系统管理 -> 全局安全配置选择授权策略 :Role-based Authorization Strategy插件创建用户 首页 -> 系统管理 -> 管理…

ENSP之虚拟化安全性的图形界面和命令行不一致的问题

问题报错:40报错 原因:命令行和图形界面不一致 图形界面显示未启用命令行里面并不是如下显示,显示的是hyper-v监控程序正在运行(CMD中输入systeminfo)如果你也遇到此类情况,请参考我的另一份文档 如何关闭VBS的随笔:https://www.cnblogs.com/never-say-die/p/16840030.h…

(原创)odoo Binary字段类型保存文件名称

需要单独指定保存文件名称的字段 清风明月入怀抱,猿鹤听我再抚琴

罗马尼亚-未被完全开发的欧洲瑰宝

罗马尼亚,未被完全开发的欧洲瑰宝自从10月中旬来参加第12届罗马尼亚国际太阳能展(CISOLAR)后,小编同事近日参加完慕尼黑电子展后又杀回到罗马尼亚,结合前线最新消息,给到大家一些信息供参考:罗马尼亚的家庭储能市场正在经历显著的增长,主要得益于政府政策的支持和市场需…

职场小白必备!Win电脑简单又高效的5款工具软件

初入职场,面对繁杂的工作任务,善用高效工具能让我们迅速上手,提升效率,轻松应对各种挑战。今天就给大家分享 5 款 Windows 电脑上简单易用且功能强大的工具软件,助力职场小白快速蜕变。 一、Everything:文件搜索 “闪电侠” 刚踏入职场,电脑里文件越来越多,找个文档常常…

70 个群都来问我的 AI 日报,是这么做的。

最近我给 FastGPT 用户交流群里接入了 AI 日报,每天早上 10 点会自动向群里推送 AI 日报,让群里的小伙伴们第一时间了解到昨天 AI 领域都发生了哪些大事。 效果大概是这个样子的:如果你对 FastGPT 感兴趣,可以直接扫码入群:除此之外,我还同步一份到公司的飞书群里,这样公…

vxe-table 使用单元格选取功能

通过参数 mouse-config.area 启用单元格选取功能、Excel 区域选取。<template><div><vxe-tableborderheight="500":column-config="{resizable: true}":mouse-config="{area: true, extension: false}":data="tableData&quo…

vxe-table 单元格选取功能与多个区域选取功能

多区域选取通过 mouse-config。area 与 area-config.multiple 启用,area-config.selectCellByHeader 用于启用表头选取功能,开启后选取表头自定义选取一整列的所有单元格<template><div><vxe-tableborderheight="500":column-config="{resizab…

Java NIO(io模型,三大组件,网络编程)

一、NIO Java NIO(New I/O,新的输入输出)是 Java 1.4 引入的一套 I/O 库,相比传统的 IO(字节流和字符流),它主要用于处理高效的、非阻塞的 I/O 操作,特别是在需要处理大规模数据或高并发的场景中表现突出。Java NIO 提供了非阻塞模式、内存映射文件、缓冲区等一系列增强…

基于bootstrap4封装的消息对话框组件

在线预览 下载这是一款基于bootstrap4封装的消息对话框组件。该消息组件包括dialog,alert,confirm,input,success,error,notice。并且对话框支持鼠标或手指触摸拖拽。使用方法 在页面中引入下面的文件。lt;link rel="stylesheet" href="bootstrap-4.0.0-dist/…

在暴雨中追逐一只白色的猫

写在前面234 字 | 希望 | 苦难 | 永恒 | 唯心主义与唯物主义正文我在暴雨中追逐一只白色的猫,毛发柔顺如云,如羽毛。雨落我身,不亲近猫。 <br />白色的猫左跳右跳,跳上月球,跳上没有暴雨的广寒宫。我听见有人哭,有人笑。 <br />我在暴雨中望着白色的月球,雨…