tiny-vue_version0/examples/sites/demos/pc/app/grid/large-data/load-column-composition-api...

35 lines
819 B
Vue
Raw Permalink 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>
<tiny-button @click="loadData" style="max-width: 200px; margin-bottom: 20px"
>空表格请点击生成 1000 </tiny-button
>
<tiny-grid ref="tinyGridRef" height="300"></tiny-grid>
</div>
</template>
<script setup lang="jsx">
import { ref } from 'vue'
import { Button as TinyButton, Grid as TinyGrid } from '@opentiny/vue'
const columns = []
const tableData = []
for (let i = 0; i < 1000; i++) {
columns.push({ width: 300, field: 'attr' + (i + 1), title: 'col' + (i + 1) })
}
for (let k = 0; k < 100; k++) {
const row = {}
for (let c = 1; c <= 1000; c++) {
row[`attr${c}`] = `row${k}_col${c}`
}
tableData.push(row)
}
const tinyGridRef = ref()
function loadData() {
tinyGridRef.value.loadColumn(columns)
tinyGridRef.value.loadData(tableData)
}
</script>