使用背景

使用el-table,页面显示几百上千条数据的时候十分卡顿。

实现内容

  1. 使用umy-ui组件(umy-ui官网),解决数据量大卡顿的问题。

解决方法

  1. 安装
npm install umy-ui
  1. 引入
<script>
	 import Vue from 'vue';
	 import UmyUi from 'umy-ui'
	 import 'umy-ui/lib/theme-chalk/index.css';// 引入样式
	 import App from './App.vue';
	
	 Vue.use(UmyUi);
	
	 new Vue({
	   el: '#app',
	   render: h => h(App)
	 });
</script>
  1. 使用
    增加:row-height=“32” use-virtual属性
 <u-table ref="productionTable" :row-height="32" use-virtual v-loading="table.loading" :data="table.tableData" show-body-overflow="tooltip" highlight-current-row height="480" @selection-change="handleSelectionChange">
	<u-table-column type="selection" width="44" align="center" fixed></u-table-column>
	<u-table-column label="代号" prop="11111" align="left" min-width="120px" show-overflow-tooltip>
		<template slot-scope="scope">
			<span>{{ scope.row.11111|| '-' }}</span>
		</template>
	</u-table-column>
</u-table>
Logo

DAMO开发者矩阵,由阿里巴巴达摩院和中国互联网协会联合发起,致力于探讨最前沿的技术趋势与应用成果,搭建高质量的交流与分享平台,推动技术创新与产业应用链接,围绕“人工智能与新型计算”构建开放共享的开发者生态。

更多推荐