Files
vxe-table/examples/views/table/scroll/ScrollCols.vue
xuliangzhan b0df06868a update
2019-07-03 19:26:27 +08:00

42 lines
1.3 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>虚拟滚动渲染加载 1 万行 1 万列</p>
<p>大数据不建议使用双向绑定的 <table-api-link name="data"/> 属性vue 监听会大数据会短暂的卡顿建议使用 <table-api-link prop="loadData"/>/<table-api-link prop="loadColumn"/> 函数</p>
<p class="red">注意如果要启用横向虚拟滚动所有的列宽度必须一致否则无法兼容</p>
<vxe-grid
border
show-overflow
show-header-overflow
ref="xTable"
height="300"
:loading="loading"
:select-config="{checkField: 'checked'}"
:optimization ="{scrollY: {gt: 500, oSize: 10, rSize: 30}}">
</vxe-grid>
</div>
</template>
<script>
export default {
data () {
return {
loading: false
}
},
created () {
this.loading = true
setTimeout(() => {
let tableData = window.MOCK_DATA_LIST.slice(0, 10000)
let tableColumn = window.MOCK_COLUMN_LIST.slice(0, 10000).map(item => Object.assign({}, item, { fixed: undefined }))
// 阻断 vue 对大数组的双向绑定,大数据性能翻倍提升
if (this.$refs.xTable) {
this.$refs.xTable.loadColumn(tableColumn)
this.$refs.xTable.loadData(tableData)
}
this.loading = false
}, 500)
}
}
</script>