From 8529369e3131b603742563bf6875c04d3cc6dee0 Mon Sep 17 00:00:00 2001 From: =?UTF-8?q?=E6=A2=81=E7=81=8F?= Date: Wed, 8 Apr 2020 16:33:54 +0800 Subject: [PATCH] Table column add new prop: display --- src/components/table/cell.vue | 1 + src/components/table/slot.js | 14 ++++++++++++-- src/styles/components/table.less | 8 ++++++++ 3 files changed, 21 insertions(+), 2 deletions(-) diff --git a/src/components/table/cell.vue b/src/components/table/cell.vue index bdcb31f6..3eff914b 100644 --- a/src/components/table/cell.vue +++ b/src/components/table/cell.vue @@ -35,6 +35,7 @@ v-if="renderType === 'slot'" :row="row" :column="column" + :display="column.display || 'block'" :index="index"> diff --git a/src/components/table/slot.js b/src/components/table/slot.js index 7c257a4a..970ae718 100644 --- a/src/components/table/slot.js +++ b/src/components/table/slot.js @@ -8,13 +8,23 @@ export default { column: { type: Object, default: null + }, + display: { + type: String, + default: 'block' } }, render: (h, ctx) => { - return h('div', ctx.injections.tableRoot.$scopedSlots[ctx.props.column.slot]({ + return h('div', { + 'class': { + 'ivu-table-cell-slot': true, + 'ivu-table-cell-slot-inline': ctx.props.display === 'inline', + 'ivu-table-cell-slot-inline-block': ctx.props.display === 'inline-block' + } + }, ctx.injections.tableRoot.$scopedSlots[ctx.props.column.slot]({ row: ctx.props.row, column: ctx.props.column, index: ctx.props.index })); } -}; \ No newline at end of file +}; diff --git a/src/styles/components/table.less b/src/styles/components/table.less index ef061290..a9504625 100644 --- a/src/styles/components/table.less +++ b/src/styles/components/table.less @@ -289,6 +289,14 @@ height: 16px; } } + &-slot{ + &-inline{ + display: inline; + } + &-inline-block{ + display: inline-block; + } + } } &-hidden{ visibility: hidden;