From de7279399d443926ddce90395bb19cd471d48e80 Mon Sep 17 00:00:00 2001 From: Wit〆苗大 <38201220+WitMiao@users.noreply.github.com> Date: 星期二, 05 七月 2022 11:56:29 +0800 Subject: [PATCH] fix(table): 彻底修复column.slots已废弃的antd报错, 所有用到的demo页修改为antd 3.x v-slot:headerCell 和 v-slot:bodyCell 写法 (#2030) --- src/views/demo/table/AuthColumn.vue | 92 +++++++++++++++++++++++---------------------- 1 files changed, 47 insertions(+), 45 deletions(-) diff --git a/src/views/demo/table/AuthColumn.vue b/src/views/demo/table/AuthColumn.vue index a611324..ae5ed9d 100644 --- a/src/views/demo/table/AuthColumn.vue +++ b/src/views/demo/table/AuthColumn.vue @@ -1,55 +1,57 @@ <template> <div class="p-4"> <BasicTable @register="registerTable"> - <template #action="{ record }"> - <TableAction - :actions="[ - { - label: '缂栬緫', - onClick: handleEdit.bind(null, record), - auth: 'other', // 鏍规嵁鏉冮檺鎺у埗鏄惁鏄剧ず: 鏃犳潈闄愶紝涓嶆樉绀� - }, - { - label: '鍒犻櫎', - icon: 'ic:outline-delete-outline', - onClick: handleDelete.bind(null, record), - auth: 'super', // 鏍规嵁鏉冮檺鎺у埗鏄惁鏄剧ず: 鏈夋潈闄愶紝浼氭樉绀� - }, - ]" - :dropDownActions="[ - { - label: '鍚敤', - popConfirm: { - title: '鏄惁鍚敤锛�', - confirm: handleOpen.bind(null, record), + <template #bodyCell="{ column, record }"> + <template v-if="column.key === 'action'"> + <TableAction + :actions="[ + { + label: '缂栬緫', + onClick: handleEdit.bind(null, record), + auth: 'other', // 鏍规嵁鏉冮檺鎺у埗鏄惁鏄剧ず: 鏃犳潈闄愶紝涓嶆樉绀� }, - ifShow: (_action) => { - return record.status !== 'enable'; // 鏍规嵁涓氬姟鎺у埗鏄惁鏄剧ず: 闈瀍nable鐘舵�佺殑涓嶆樉绀哄惎鐢ㄦ寜閽� + { + label: '鍒犻櫎', + icon: 'ic:outline-delete-outline', + onClick: handleDelete.bind(null, record), + auth: 'super', // 鏍规嵁鏉冮檺鎺у埗鏄惁鏄剧ず: 鏈夋潈闄愶紝浼氭樉绀� }, - }, - { - label: '绂佺敤', - popConfirm: { - title: '鏄惁绂佺敤锛�', - confirm: handleOpen.bind(null, record), + ]" + :dropDownActions="[ + { + label: '鍚敤', + popConfirm: { + title: '鏄惁鍚敤锛�', + confirm: handleOpen.bind(null, record), + }, + ifShow: (_action) => { + return record.status !== 'enable'; // 鏍规嵁涓氬姟鎺у埗鏄惁鏄剧ず: 闈瀍nable鐘舵�佺殑涓嶆樉绀哄惎鐢ㄦ寜閽� + }, }, - ifShow: () => { - return record.status === 'enable'; // 鏍规嵁涓氬姟鎺у埗鏄惁鏄剧ず: enable鐘舵�佺殑鏄剧ず绂佺敤鎸夐挳 + { + label: '绂佺敤', + popConfirm: { + title: '鏄惁绂佺敤锛�', + confirm: handleOpen.bind(null, record), + }, + ifShow: () => { + return record.status === 'enable'; // 鏍规嵁涓氬姟鎺у埗鏄惁鏄剧ず: enable鐘舵�佺殑鏄剧ず绂佺敤鎸夐挳 + }, }, - }, - { - label: '鍚屾椂鎺у埗', - popConfirm: { - title: '鏄惁鍔ㄦ�佹樉绀猴紵', - confirm: handleOpen.bind(null, record), + { + label: '鍚屾椂鎺у埗', + popConfirm: { + title: '鏄惁鍔ㄦ�佹樉绀猴紵', + confirm: handleOpen.bind(null, record), + }, + auth: 'super', // 鍚屾椂鏍规嵁鏉冮檺鍜屼笟鍔℃帶鍒舵槸鍚︽樉绀� + ifShow: () => { + return true; + }, }, - auth: 'super', // 鍚屾椂鏍规嵁鏉冮檺鍜屼笟鍔℃帶鍒舵槸鍚︽樉绀� - ifShow: () => { - return true; - }, - }, - ]" - /> + ]" + /> + </template> </template> </BasicTable> </div> @@ -104,7 +106,7 @@ width: 250, title: 'Action', dataIndex: 'action', - slots: { customRender: 'action' }, + // slots: { customRender: 'action' }, }, }); function handleEdit(record: Recordable) { -- Gitblit v1.8.0