11<script setup lang="ts">
2- import type { TableColumnProps } from ' @/element-plus'
2+ import type { TableColumnSchema } from ' @/element-plus'
33import { sleep } from ' @antfu/utils'
44import { ElMessage } from ' element-plus'
55import { reactive , ref } from ' vue'
88 SectionItem ,
99 SectionLayout ,
1010 SectionMain ,
11- TableColumnsRender ,
11+ TableSchemaColumns ,
1212 Toolbar ,
1313 usePagination ,
1414} from ' @/element-plus'
@@ -70,7 +70,7 @@ const basicData = ref<BasicDataItem[]>([
7070 },
7171])
7272
73- const basicColumns: TableColumnProps <BasicDataItem >[] = [
73+ const basicColumns: TableColumnSchema <BasicDataItem >[] = [
7474 {
7575 prop: ' id' ,
7676 label: ' ID' ,
@@ -143,7 +143,7 @@ const nestedData = ref<NestedDataItem[]>([
143143 },
144144])
145145
146- const nestedColumns: TableColumnProps <NestedDataItem >[] = [
146+ const nestedColumns: TableColumnSchema <NestedDataItem >[] = [
147147 {
148148 prop: ' date' ,
149149 label: ' 日期' ,
@@ -208,7 +208,7 @@ const slotData = ref<SlotDataItem[]>([
208208 { id: 4 , product: ' AirPods Pro' , price: 1899 , stock: 50 , category: ' 配件' },
209209])
210210
211- const slotColumns: TableColumnProps <SlotDataItem >[] = [
211+ const slotColumns: TableColumnSchema <SlotDataItem >[] = [
212212 {
213213 prop: ' id' ,
214214 label: ' ID' ,
@@ -298,7 +298,7 @@ const renderData = ref<RenderDataItem[]>([
298298 },
299299])
300300
301- const renderColumns: TableColumnProps <RenderDataItem >[] = [
301+ const renderColumns: TableColumnSchema <RenderDataItem >[] = [
302302 {
303303 prop: ' id' ,
304304 label: ' ID' ,
@@ -432,7 +432,7 @@ async function loadPaginationData(page: number, pageSize: number) {
432432// 初始加载
433433loadPaginationData (1 , 10 )
434434
435- const paginationColumns: TableColumnProps <PaginationDataItem >[] = [
435+ const paginationColumns: TableColumnSchema <PaginationDataItem >[] = [
436436 {
437437 type: ' selection' ,
438438 width: 55 ,
@@ -558,7 +558,7 @@ function getStockStatus(stock: number) {
558558 fill
559559 >
560560 <ElText tag =" b" >
561- TableColumnsRender 组件配置
561+ TableSchemaColumns 组件配置
562562 </ElText >
563563
564564 <ElSpace wrap >
@@ -605,7 +605,7 @@ function getStockStatus(stock: number) {
605605 fill
606606 >
607607 <ElText >
608- <code >TableColumnsRender </code > 是对 Element Plus 的
608+ <code >TableSchemaColumns </code > 是对 Element Plus 的
609609 <code >ElTableColumn</code > 组件的封装,
610610 通过配置化的方式定义表格列,支持嵌套列、自定义插槽和渲染函数。
611611 </ElText >
@@ -616,14 +616,14 @@ function getStockStatus(stock: number) {
616616 stripe
617617 style =" width : 100% "
618618 >
619- <TableColumnsRender :columns =" basicColumns" >
619+ <TableSchemaColumns :columns =" basicColumns" >
620620 <!-- 使用模板插槽自定义状态列 -->
621621 <template #default :status =" { row } " >
622622 <ElTag :type =" getStatusType(row.status)" >
623623 {{ getStatusText(row.status) }}
624624 </ElTag >
625625 </template >
626- </TableColumnsRender >
626+ </TableSchemaColumns >
627627 </ElTable >
628628
629629 <ElAlert
@@ -668,7 +668,7 @@ function getStockStatus(stock: number) {
668668 border
669669 style =" width : 100% "
670670 >
671- <TableColumnsRender :columns =" nestedColumns" />
671+ <TableSchemaColumns :columns =" nestedColumns" />
672672 </ElTable >
673673
674674 <ElAlert
@@ -715,7 +715,7 @@ function getStockStatus(stock: number) {
715715 stripe
716716 style =" width : 100% "
717717 >
718- <TableColumnsRender :columns =" slotColumns" >
718+ <TableSchemaColumns :columns =" slotColumns" >
719719 <!-- 产品名称插槽 -->
720720 <template #default :product-cell =" { row } " >
721721 <ElText
@@ -747,7 +747,7 @@ function getStockStatus(stock: number) {
747747 <span >{{ column.label }}</span >
748748 </ElSpace >
749749 </template >
750- </TableColumnsRender >
750+ </TableSchemaColumns >
751751 </ElTable >
752752
753753 <ElAlert
@@ -803,7 +803,7 @@ function getStockStatus(stock: number) {
803803 stripe
804804 style =" width : 100% "
805805 >
806- <TableColumnsRender :columns =" renderColumns" >
806+ <TableSchemaColumns :columns =" renderColumns" >
807807 <!-- 标题列 -->
808808 <template #default :render-title =" { row } " >
809809 <div style =" display : flex ; align-items : center ; gap : 8px " >
@@ -873,7 +873,7 @@ function getStockStatus(stock: number) {
873873 </ElButton >
874874 </ElSpace >
875875 </template >
876- </TableColumnsRender >
876+ </TableSchemaColumns >
877877 </ElTable >
878878
879879 <ElAlert
@@ -948,7 +948,7 @@ function getStockStatus(stock: number) {
948948 style =" width : 100% "
949949 @selection-change =" handleSelectionChange"
950950 >
951- <TableColumnsRender :columns =" paginationColumns" >
951+ <TableSchemaColumns :columns =" paginationColumns" >
952952 <!-- 角色列 -->
953953 <template #default :pagination-role =" { row } " >
954954 <ElTag
@@ -1004,7 +1004,7 @@ function getStockStatus(stock: number) {
10041004 </ElButton >
10051005 </ElSpace >
10061006 </template >
1007- </TableColumnsRender >
1007+ </TableSchemaColumns >
10081008 </ElTable >
10091009
10101010 <div
@@ -1073,18 +1073,19 @@ function getStockStatus(stock: number) {
10731073 >
10741074 <div >
10751075 <ElText tag =" b" >
1076- 属性 (TableColumnsRenderProps ):
1076+ 属性 (TableSchemaColumnsProps ):
10771077 </ElText >
10781078 <ul style =" margin : 8px 0 ; padding-left : 20px " >
10791079 <li >
1080- <code >columns</code >: TableColumnProps[](必填)- 列定义数组
1080+ <code >columns</code >: TableColumnSchema[](必填)-
1081+ 列定义数组
10811082 </li >
10821083 </ul >
10831084 </div >
10841085
10851086 <div >
10861087 <ElText tag =" b" >
1087- 列配置 (TableColumnProps ):
1088+ 列配置 (TableColumnSchema ):
10881089 </ElText >
10891090 <ul style =" margin : 8px 0 ; padding-left : 20px " >
10901091 <li ><code >prop</code >: string - 对应列内容的字段名</li >
@@ -1105,7 +1106,7 @@ function getStockStatus(stock: number) {
11051106 列的类型
11061107 </li >
11071108 <li >
1108- <code >children</code >: TableColumnProps [] -
1109+ <code >children</code >: TableColumnSchema [] -
11091110 子列定义(用于多级表头)
11101111 </li >
11111112 <li >
@@ -1126,7 +1127,7 @@ function getStockStatus(stock: number) {
11261127
11271128 <div >
11281129 <ElText tag =" b" >
1129- 插槽 (TableColumnsRenderSlots ):
1130+ 插槽 (TableSchemaColumnsSlots ):
11301131 </ElText >
11311132 <ul style =" margin : 8px 0 ; padding-left : 20px " >
11321133 <li >
0 commit comments