mirror of
https://github.com/element-plus/element-plus.git
synced 2026-03-13 07:51:17 +08:00
docs(components): [virtualized-table] finishing leftovers (#7496)
- Finishing the documentation examples - Add APIs to the documentation - Fix some issue while updating the documentations
This commit is contained in:
@@ -1,11 +1,41 @@
|
||||
<template>
|
||||
<table-v2 :columns="columns" :data="data" :width="700" :height="400" fixed />
|
||||
<el-table-v2
|
||||
:columns="columns"
|
||||
:data="data"
|
||||
:width="700"
|
||||
:height="400"
|
||||
fixed
|
||||
/>
|
||||
</template>
|
||||
|
||||
<script lang="ts" setup>
|
||||
import TableV2 from '@element-plus/components/table-v2/src/table-v2'
|
||||
import { generateColumns, generateData } from './utils'
|
||||
const generateColumns = (length = 10, prefix = 'column-', props?: any) =>
|
||||
Array.from({ length }).map((_, columnIndex) => ({
|
||||
...props,
|
||||
key: `${prefix}${columnIndex}`,
|
||||
dataKey: `${prefix}${columnIndex}`,
|
||||
title: `Column ${columnIndex}`,
|
||||
width: 150,
|
||||
}))
|
||||
|
||||
const generateData = (
|
||||
columns: ReturnType<typeof generateColumns>,
|
||||
length = 200,
|
||||
prefix = 'row-'
|
||||
) =>
|
||||
Array.from({ length }).map((_, rowIndex) => {
|
||||
return columns.reduce(
|
||||
(rowData, column, columnIndex) => {
|
||||
rowData[column.dataKey] = `Row ${rowIndex} - Col ${columnIndex}`
|
||||
return rowData
|
||||
},
|
||||
{
|
||||
id: `${prefix}${rowIndex}`,
|
||||
parentId: null,
|
||||
}
|
||||
)
|
||||
})
|
||||
|
||||
const columns = generateColumns(10)
|
||||
const data = generateData(columns, 1000)
|
||||
const data = generateData(columns, 200)
|
||||
</script>
|
||||
|
||||
Reference in New Issue
Block a user