tiny-vue/examples/docs/resources/pc/demo/grid/tiny-first-menu/grid-optimization.vue

90 lines
3.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>
<tiny-grid :data="tableData" :optimization="optimizationData">
<tiny-grid-column type="index" width="60"></tiny-grid-column>
<tiny-grid-column field="name" title="名称"></tiny-grid-column>
<tiny-grid-column field="area" title="所属区域"></tiny-grid-column>
<tiny-grid-column field="address" title="地址"></tiny-grid-column>
<tiny-grid-column field="introduction" title="公司简介" show-overflow></tiny-grid-column>
</tiny-grid>
</template>
<script lang="jsx">
import { Grid, GridColumn } from '@opentiny/vue'
export default {
components: {
TinyGrid: Grid,
TinyGridColumn: GridColumn
},
created() {
this.tableData = [...this.tableData, ...this.tableData, ...this.tableData, ...this.tableData]
},
data() {
return {
optimizationData: {
animat: false,
delayHover: 1000,
scrollX: {
gt: 100, // 指定大于多少范围时自动启动虚拟滚动(启用 X 虚拟滚动必须固定所有列宽否则无法兼容默认100
oSize: 2, // 当剩余数据少于指定范围时触发重新渲染 默认自动计算
rSize: 2, // 每次渲染条数 默认自动计算
vSize: 5 // 指定可视区域条数
},
scrollY: {
gt: 500, // 指定大于多少范围时自动启动虚拟滚动(启用 Y 虚拟滚动必须固定所有行高否则无法兼容默认500
oSize: 2, // 当剩余数据少于指定范围时触发重新渲染 默认自动计算
rSize: 2, // 每次渲染条数 默认自动计算
vSize: 5, // 指定可视区域条数 默认自动计算
rHeight: 50, // 指定行高 默认自动计算
adaptive: true // 自动适配最优的渲染方式 默认true
}
},
tableData: [
{
id: '1',
name: 'GFD科技YX公司',
area: '华东区',
address: '福州',
introduction: '公司技术和研发实力雄厚是国家863项目的参与者并被政府认定为“高新技术企业”。'
},
{
id: '2',
name: 'WWWW科技YX公司',
area: '华南区',
address: '深圳福田区',
introduction: '公司技术和研发实力雄厚是国家863项目的参与者并被政府认定为“高新技术企业”。'
},
{
id: '3',
name: 'RFV有限责任公司',
area: '华南区',
address: '中山市',
introduction: '公司技术和研发实力雄厚是国家863项目的参与者并被政府认定为“高新技术企业”。'
},
{
id: '4',
name: 'TGBYX公司',
area: '华北区',
address: '梅州',
introduction: '公司技术和研发实力雄厚是国家863项目的参与者并被政府认定为“高新技术企业”。'
},
{
id: '5',
name: 'YHN科技YX公司',
area: '华南区',
address: '韶关',
introduction: '公司技术和研发实力雄厚是国家863项目的参与者并被政府认定为“高新技术企业”。'
},
{
id: '6',
name: '康康物业YX公司',
area: '华北区',
address: '广州天河区',
introduction: '公司技术和研发实力雄厚是国家863项目的参与者并被政府认定为“高新技术企业”。'
}
]
}
}
}
</script>