赞
踩
官网示例地址——https://happy-coding-clans.github.io/vue-easytable/#/zh/doc/table/virtual-scroll
第一步:安包
npm i vue-easytable
第二步:引入包文件
src/main.js
import "vue-easytable/libs/theme-default/index.css";
import VueEasytable from "vue-easytable";
Vue.use(VueEasytable);
第三步:文件中进行使用
src/views/table.vue
<template> <div> <ve-table :max-height="500" :virtual-scroll-option="virtualScrollOption" :columns="columns" :table-data="tableData" row-key-field-name="rowKey" /> </div> </template> <script> export default { data() { return { virtualScrollOption: { // 是否开启 enable: true, }, columns: [ { field: "index", key: "a", title: "#", width: 100, align: "left", }, { field: "name", key: "b", title: "Name", width: 200, align: "left", }, { field: "hobby", key: "c", title: "Hobby", width: 300, align: "left", }, { field: "address", key: "d", title: "Address", width: "", align: "left", }, ], tableData: [], }; }, methods: { initData() { let data = []; for (let i = 0; i < 10000; i++) { data.push({ rowKey: i, index: i, name: `name${i}`, hobby: `hobby${i}`, address: `address${i}`, }); } this.tableData = data; }, }, created() { this.initData(); }, }; </script>
效果-表格滚动
赞
踩
Copyright © 2003-2013 www.wpsshop.cn 版权所有,并保留所有权利。