Skip to content

Commit

Permalink
update docs
Browse files Browse the repository at this point in the history
  • Loading branch information
xuliangzhan committed Jan 2, 2025
1 parent ed7fd9d commit c80ef8c
Showing 1 changed file with 128 additions and 109 deletions.
237 changes: 128 additions & 109 deletions examples/views/grid/GridTest.vue
Original file line number Diff line number Diff line change
@@ -1,122 +1,19 @@
<template>
<div>
<vxe-select v-model="rowSize" :options="dataOptions" @change="loadData()"></vxe-select>
<vxe-table
border
height="800"
:loading="loading"
:column-config="{resizable: true}"
:scroll-x="{enabled: true, gt: 0}"
:scroll-y="{enabled: true, gt: 0}"
:data="tableData">
<vxe-column type="checkbox" width="60"></vxe-column>
<vxe-column field="col0" title="列0" width="100"></vxe-column>
<vxe-column field="imgUrl" title="列1" width="80" :cell-render="imgUrlCellRender"></vxe-column>
<vxe-column field="col2" title="列2" width="160"></vxe-column>
<vxe-column field="col3" title="列3" width="200"></vxe-column>
<vxe-column field="col4" title="列4" width="140"></vxe-column>
<vxe-column field="col5" title="列5" width="300"></vxe-column>
<vxe-column field="col6" title="列6" width="160"></vxe-column>
<vxe-column field="col7" title="列7" width="120"></vxe-column>
<vxe-column field="col8" title="列8" width="400"></vxe-column>
<vxe-column field="col9" title="列9" width="160"></vxe-column>
<vxe-column field="col10" title="列10" width="160"></vxe-column>
<vxe-column field="col11" title="列11" width="180"></vxe-column>
<vxe-column field="col12" title="列12" width="160"></vxe-column>
<vxe-column field="col13" title="列13" width="80"></vxe-column>
<vxe-column field="col14" title="列14" width="120"></vxe-column>
<vxe-column field="col15" title="列15" width="360"></vxe-column>
<vxe-column field="col16" title="列16" width="150"></vxe-column>
<vxe-column field="col17" title="列17" width="380"></vxe-column>
<vxe-column field="col18" title="列18" width="100"></vxe-column>
<vxe-column field="col19" title="列19" width="290"></vxe-column>
<vxe-column field="col20" title="列20" width="80"></vxe-column>
<vxe-column field="col21" title="列21" width="100"></vxe-column>
<vxe-column field="col22" title="列22" width="120"></vxe-column>
<vxe-column field="col23" title="列23" width="270"></vxe-column>
<vxe-column field="col24" title="列24" width="330"></vxe-column>
<vxe-column field="col25" title="列25" width="460"></vxe-column>
<vxe-column field="col26" title="列26" width="280"></vxe-column>
<vxe-column field="col27" title="列27" width="220"></vxe-column>
<vxe-column field="col28" title="列28" width="120"></vxe-column>
<vxe-column field="col29" title="列29" width="180"></vxe-column>
<vxe-column field="col30" title="列30" width="500"></vxe-column>
<vxe-column field="col31" title="列31" width="600"></vxe-column>
<vxe-column field="col32" title="列32" width="100"></vxe-column>
<vxe-column field="col33" title="列33" width="490"></vxe-column>
<vxe-column field="col34" title="列34" width="100"></vxe-column>
<vxe-column field="col35" title="列35" width="150"></vxe-column>
<vxe-column field="col36" title="列36" width="800"></vxe-column>
<vxe-column field="col37" title="列37" width="400"></vxe-column>
<vxe-column field="col38" title="列38" width="800"></vxe-column>
<vxe-column field="col39" title="列39" width="360"></vxe-column>
<vxe-column field="col40" title="列40" width="420"></vxe-column>
<vxe-column field="col41" title="列41" width="100"></vxe-column>
<vxe-column field="col42" title="列42" width="120"></vxe-column>
<vxe-column field="col43" title="列43" width="280"></vxe-column>
<vxe-column field="col44" title="列44" width="170"></vxe-column>
<vxe-column field="col45" title="列45" width="370"></vxe-column>
<vxe-column field="col46" title="列46" width="120"></vxe-column>
<vxe-column field="col47" title="列47" width="170"></vxe-column>
<vxe-column field="col48" title="列48" width="400"></vxe-column>
<vxe-column field="col49" title="列49" width="220"></vxe-column>
<vxe-column field="col50" title="列50" width="170"></vxe-column>
<vxe-column field="col51" title="列51" width="160"></vxe-column>
<vxe-column field="col52" title="列52" width="100"></vxe-column>
<vxe-column field="col53" title="列53" width="280"></vxe-column>
<vxe-column field="col54" title="列54" width="170"></vxe-column>
<vxe-column field="col55" title="列55" width="370"></vxe-column>
<vxe-column field="col56" title="列56" width="120"></vxe-column>
<vxe-column field="col57" title="列57" width="170"></vxe-column>
<vxe-column field="col58" title="列58" width="400"></vxe-column>
<vxe-column field="col59" title="列59" width="220"></vxe-column>
<vxe-column field="col60" title="列60" width="500"></vxe-column>
<vxe-column field="col61" title="列61" width="600"></vxe-column>
<vxe-column field="col62" title="列62" width="100"></vxe-column>
<vxe-column field="col63" title="列63" width="490"></vxe-column>
<vxe-column field="col64" title="列64" width="100"></vxe-column>
<vxe-column field="col65" title="列65" width="150"></vxe-column>
<vxe-column field="col66" title="列66" width="800"></vxe-column>
<vxe-column field="col67" title="列67" width="400"></vxe-column>
<vxe-column field="col68" title="列68" width="800"></vxe-column>
<vxe-column field="col69" title="列69" width="360"></vxe-column>
<vxe-column field="col70" title="列70" width="500"></vxe-column>
<vxe-column field="col71" title="列71" width="600"></vxe-column>
<vxe-column field="col72" title="列72" width="100"></vxe-column>
<vxe-column field="col73" title="列73" width="490"></vxe-column>
<vxe-column field="col74" title="列74" width="100"></vxe-column>
<vxe-column field="col75" title="列75" width="150"></vxe-column>
<vxe-column field="col76" title="列76" width="800"></vxe-column>
<vxe-column field="col77" title="列77" width="400"></vxe-column>
<vxe-column field="col78" title="列78" width="800"></vxe-column>
<vxe-column field="col79" title="列79" width="360"></vxe-column>
<vxe-column field="col80" title="列80" width="500"></vxe-column>
<vxe-column field="col81" title="列81" width="600"></vxe-column>
<vxe-column field="col82" title="列82" width="100"></vxe-column>
<vxe-column field="col83" title="列83" width="490"></vxe-column>
<vxe-column field="col84" title="列84" width="100"></vxe-column>
<vxe-column field="col85" title="列85" width="150"></vxe-column>
<vxe-column field="col86" title="列86" width="800"></vxe-column>
<vxe-column field="col87" title="列87" width="400"></vxe-column>
<vxe-column field="col88" title="列88" width="800"></vxe-column>
<vxe-column field="col89" title="列89" width="360"></vxe-column>
</vxe-table>
<vxe-grid v-bind="gridOptions"></vxe-grid>
</div>
</template>

<script lang="ts" setup>
import { ref, reactive, nextTick } from 'vue'
import { VxeUI } from '../../../packages'
import { VxeColumnPropTypes } from '../../../types'
import { VxeUI, VxeGridProps, VxeColumnPropTypes } from '../../../types'
interface RowVO {
id: number
[key: string]: string | number | boolean | any[]
}
const tableData = ref<RowVO[]>([])
const loading = ref(false)
const rowSize = ref(100)
const dataOptions = ref([
{ label: '加载 3 行', value: 3 },
Expand All @@ -137,9 +34,131 @@ const imgUrlCellRender = reactive<VxeColumnPropTypes.CellRender>({
}
})
const gridOptions = reactive<VxeGridProps<RowVO>>({
border: true,
loading: false,
height: 800,
columnConfig: {
resizable: true
},
scrollX: {
enabled: true,
gt: 0
},
scrollY: {
enabled: true,
gt: 0
},
columns: [
{ type: 'checkbox', width: 60 },
{ title: '列0', field: 'col0', width: 100 },
{ title: '列1', field: 'imgUrl', width: 80, cellRender: imgUrlCellRender },
{ title: '列2', field: 'col2', width: 160 },
{ title: '列3', field: 'col3', width: 200 },
{ title: '列4', field: 'col4', width: 140 },
{ title: '列5', field: 'col5', width: 300 },
{ title: '列6', field: 'col6', width: 160 },
{ title: '列7', field: 'col7', width: 120 },
{ title: '列8', field: 'col8', width: 400 },
{ title: '列9', field: 'col9', width: 160 },
{ title: '列10', field: 'col10', width: 160 },
{ title: '列11', field: 'col11', width: 180 },
{ title: '列12', field: 'col12', width: 160 },
{ title: '列13', field: 'col13', width: 80 },
{ title: '列14', field: 'col14', width: 120 },
{ title: '列15', field: 'col15', width: 360 },
{ title: '列16', field: 'col16', width: 150 },
{ title: '列17', field: 'col17', width: 380 },
{ title: '列18', field: 'col18', width: 100 },
{ title: '列19', field: 'col19', width: 290 },
{ title: '列20', field: 'col20', width: 80 },
{ title: '列21', field: 'col21', width: 100 },
{ title: '列22', field: 'col22', width: 120 },
{ title: '列23', field: 'col23', width: 270 },
{ title: '列24', field: 'col24', width: 330 },
{ title: '列25', field: 'col25', width: 460 },
{ title: '列26', field: 'col26', width: 280 },
{ title: '列27', field: 'col27', width: 220 },
{ title: '列28', field: 'col28', width: 120 },
{ title: '列29', field: 'col29', width: 180 },
{ title: '列30', field: 'col30', width: 500 },
{ title: '列31', field: 'col31', width: 600 },
{ title: '列32', field: 'col32', width: 100 },
{ title: '列33', field: 'col33', width: 490 },
{ title: '列34', field: 'col34', width: 100 },
{ title: '列35', field: 'col35', width: 150 },
{ title: '列36', field: 'col36', width: 800 },
{ title: '列37', field: 'col37', width: 400 },
{ title: '列38', field: 'col38', width: 800 },
{ title: '列39', field: 'col39', width: 360 },
{ title: '列40', field: 'col40', width: 420 },
{ title: '列41', field: 'col41', width: 100 },
{ title: '列42', field: 'col42', width: 120 },
{ title: '列43', field: 'col43', width: 280 },
{ title: '列44', field: 'col44', width: 170 },
{ title: '列45', field: 'col45', width: 370 },
{ title: '列46', field: 'col46', width: 420 },
{ title: '列47', field: 'col47', width: 170 },
{ title: '列48', field: 'col48', width: 400 },
{ title: '列49', field: 'col49', width: 220 },
{ title: '列50', field: 'col50', width: 170 },
{ title: '列51', field: 'col51', width: 160 },
{ title: '列52', field: 'col52', width: 500 },
{ title: '列53', field: 'col53', width: 280 },
{ title: '列54', field: 'col54', width: 170 },
{ title: '列55', field: 'col55', width: 370 },
{ title: '列56', field: 'col56', width: 120 },
{ title: '列57', field: 'col57', width: 170 },
{ title: '列58', field: 'col58', width: 400 },
{ title: '列59', field: 'col59', width: 220 },
{ title: '列60', field: 'col60', width: 650 },
{ title: '列61', field: 'col61', width: 600 },
{ title: '列62', field: 'col62', width: 100 },
{ title: '列63', field: 'col63', width: 490 },
{ title: '列64', field: 'col64', width: 100 },
{ title: '列65', field: 'col65', width: 150 },
{ title: '列66', field: 'col66', width: 800 },
{ title: '列67', field: 'col67', width: 400 },
{ title: '列68', field: 'col68', width: 800 },
{ title: '列69', field: 'col69', width: 360 },
{ title: '列70', field: 'col70', width: 650 },
{ title: '列71', field: 'col71', width: 600 },
{ title: '列72', field: 'col72', width: 100 },
{ title: '列73', field: 'col73', width: 490 },
{ title: '列74', field: 'col74', width: 100 },
{ title: '列75', field: 'col75', width: 150 },
{ title: '列76', field: 'col76', width: 800 },
{ title: '列77', field: 'col77', width: 400 },
{ title: '列78', field: 'col78', width: 800 },
{ title: '列79', field: 'col79', width: 360 },
{ title: '列80', field: 'col80', width: 650 },
{ title: '列81', field: 'col81', width: 600 },
{ title: '列82', field: 'col82', width: 100 },
{ title: '列83', field: 'col83', width: 490 },
{ title: '列84', field: 'col84', width: 100 },
{ title: '列85', field: 'col85', width: 150 },
{ title: '列86', field: 'col86', width: 800 },
{ title: '列87', field: 'col87', width: 400 },
{ title: '列88', field: 'col88', width: 800 },
{ title: '列89', field: 'col89', width: 360 },
{ title: '列90', field: 'col90', width: 650 },
{ title: '列91', field: 'col91', width: 600 },
{ title: '列92', field: 'col92', width: 100 },
{ title: '列93', field: 'col93', width: 490 },
{ title: '列94', field: 'col94', width: 100 },
{ title: '列95', field: 'col95', width: 150 },
{ title: '列96', field: 'col96', width: 800 },
{ title: '列97', field: 'col97', width: 400 },
{ title: '列98', field: 'col98', width: 800 },
{ title: '列99', field: 'col99', width: 360 },
{ title: '列100', field: 'col100', width: 360 }
],
data: []
})
// 模拟行数据
const loadData = () => {
loading.value = true
gridOptions.loading = true
setTimeout(() => {
const dataList: RowVO[] = []
for (let i = 0; i < rowSize.value; i++) {
Expand Down Expand Up @@ -168,15 +187,15 @@ const loadData = () => {
}
const startTime = Date.now()
tableData.value = dataList
loading.value = false
gridOptions.data = dataList
gridOptions.loading = false
nextTick(() => {
VxeUI.modal.message({
content: `加载时间 ${Date.now() - startTime} 毫秒`,
status: 'success'
})
})
}, 100)
}, 350)
}
loadData()
Expand Down

0 comments on commit c80ef8c

Please sign in to comment.