From e6fb49260d1509144c389db89a6f5f95d882bbe3 Mon Sep 17 00:00:00 2001
From: chenghongxing <1126263215@qq.com>
Date: Thu, 16 Jul 2020 19:46:27 +0800
Subject: [PATCH] =?UTF-8?q?feat:=20add=20support=20for=20scopedSlots=20in?=
=?UTF-8?q?=20StandardTable.vue;=20:star2:=20=E6=96=B0=E5=A2=9E=EF=BC=9ASt?=
=?UTF-8?q?andardTable.vue=20=E7=BB=84=E4=BB=B6=E5=A2=9E=E5=8A=A0=20scoped?=
=?UTF-8?q?Slots=20=E7=9A=84=E6=94=AF=E6=8C=81=EF=BC=9B?=
MIME-Version: 1.0
Content-Type: text/plain; charset=UTF-8
Content-Transfer-Encoding: 8bit
---
src/components/table/StandardTable.vue | 11 ++++++++++-
src/pages/list/QueryList.vue | 16 ++++++++++++++--
2 files changed, 24 insertions(+), 3 deletions(-)
diff --git a/src/components/table/StandardTable.vue b/src/components/table/StandardTable.vue
index f485731..554a7cd 100644
--- a/src/components/table/StandardTable.vue
+++ b/src/components/table/StandardTable.vue
@@ -25,6 +25,9 @@
:pagination="pagination"
:rowSelection="{selectedRowKeys: selectedRowKeys, onChange: updateSelect}"
>
+
+
+
@@ -36,7 +39,8 @@ export default {
data () {
return {
needTotalList: [],
- selectedRowKeys: []
+ selectedRowKeys: [],
+ scopedSlots: []
}
},
methods: {
@@ -61,9 +65,14 @@ export default {
}
})
return totalList
+ },
+ getScopedSlots(columns) {
+ return columns.filter(item => item.scopedSlots && item.scopedSlots.customRender)
+ .map(item => item.scopedSlots.customRender)
}
},
created () {
+ this.scopedSlots = this.getScopedSlots(this.columns)
this.needTotalList = this.initTotalList(this.columns)
},
watch: {
diff --git a/src/pages/list/QueryList.vue b/src/pages/list/QueryList.vue
index 5bcab37..bcc8b44 100644
--- a/src/pages/list/QueryList.vue
+++ b/src/pages/list/QueryList.vue
@@ -97,7 +97,14 @@
:dataSource="dataSource"
:selectedRows="selectedRows"
@change="onchange"
- />
+ >
+
+ {{text}}
+
+
+
@@ -111,7 +118,8 @@ const columns = [
},
{
title: '描述',
- dataIndex: 'description'
+ dataIndex: 'description',
+ scopedSlots: { customRender: 'description' }
},
{
title: '服务调用次数',
@@ -129,6 +137,10 @@ const columns = [
title: '更新时间',
dataIndex: 'updatedAt',
sorter: true
+ },
+ {
+ title: '操作',
+ scopedSlots: { customRender: 'action' }
}
]