Files
vxe-table/examples/views/table/scroll/ScrollFullCols.vue
xuliangzhan 92a54c94bc update
2019-06-13 18:14:01 +08:00

71 lines
2.5 KiB
Vue
Raw Blame History

This file contains ambiguous Unicode characters
This file contains Unicode characters that might be confused with other characters. If you think that this is intentional, you can safely ignore this warning. Use the Escape button to reveal them.
<template>
<div>
<p>可视渲染加载 10 万行 1 万列左右固定列表尾合计</p>
<p><grid-api-link name="vxe-grid"/> 的性能比 <table-api-link name="vxe-table"/> n 因为不需要为每个 <table-column-api-link name="vxe-table-column"/> 创建实例列越多越能体现出来</p>
<p>大数据不建议使用双向绑定的 <table-api-link name="data"/> 属性vue 监听会大数据会短暂的卡顿建议使用 <table-api-link prop="loadData"/>/<table-api-link prop="reloadData"/> 函数</p>
<p>对于多选 type=<table-column-api-link prop="selection"/> 当数据量海量时应该绑定 <table-api-link prop="checkProp"/> 属性渲染速度可以提升n倍以上</p>
<p>数据超大情况下必须使用<table-api-link prop="show-all-overflow"/><table-api-link prop="show-header-all-overflow"/> 参数以及调整好 <table-api-link prop="optimization"/> {scrollX,scrollY} 适合的参数可以更加流畅</p>
<vxe-grid
ref="xTable"
border
resizable
show-footer
show-all-overflow
show-header-all-overflow
height="600"
:footer-method="footerMethod"
:footer-cell-class-name="footerCellClassName"
:loading="loading"
:columns="tableColumn"
:select-config="{checkProp: 'checked'}"
:optimization ="{scrollX: {gt: 20, oSize: 4, rSize: 8}, scrollY: {gt: 500, oSize: 20, rSize: 60}}">
</vxe-grid>
</div>
</template>
<script>
export default {
data () {
return {
loading: false,
tableColumn: [],
footerData: []
}
},
created () {
this.loading = true
this.$nextTick(() => {
this.$refs.xTable.reloadData([])
setTimeout(() => {
if (this.$refs.xTable) {
this.tableData = window.MOCK_DATA_LIST.slice(0, 100000)
this.tableColumn = window.MOCK_COLUMN_LIST.slice(0, 10000)
this.$refs.xTable.reloadData(this.tableData)
// 此为演示用,由于数据太过庞大,前端计算耗时太久
this.footerData = [
Array.from(new Array(10000)).map(item => '-'),
Array.from(new Array(10000)).map(item => '-')
]
}
this.loading = false
}, 300)
})
},
methods: {
footerCellClassName ({ rowIndex, column, columnIndex }) {
if (columnIndex === 0) {
if (rowIndex === 0) {
return 'col-blue'
} else {
return 'col-red'
}
}
},
footerMethod ({ columns, data }) {
return this.footerData
}
}
}
</script>