Skip to content

Commit

Permalink
[feature]{prop}: 加入是否显示序号列prop
Browse files Browse the repository at this point in the history
  • Loading branch information
BoBoooooo committed Oct 18, 2019
1 parent 268b736 commit 26624cd
Show file tree
Hide file tree
Showing 3 changed files with 16 additions and 1 deletion.
10 changes: 10 additions & 0 deletions src/components/CommonTable/index.vue
Original file line number Diff line number Diff line change
Expand Up @@ -38,6 +38,11 @@
@header-dragend="(newWidth, oldWidth, column, event) =>
emitEventHandler('header-dragend', newWidth, oldWidth, column, event)"
@expand-change="(row, expanded) => emitEventHandler('expand-change', row, expanded)">
<el-table-column
v-if="showColumnIndex"
type="index"
width="50">
</el-table-column>
<el-table-column v-if="IsMultiple"
type="selection"
width="55">
Expand Down Expand Up @@ -109,6 +114,11 @@ export default {
type: Object,
default: () => ({}),
},
// 是否显示序号列
showColumnIndex: {
type: Boolean,
default: false,
},
},
methods: {
emitEvent(...args) {
Expand Down
3 changes: 2 additions & 1 deletion src/components/CrudTable/CrudTable.vue
Original file line number Diff line number Diff line change
Expand Up @@ -24,7 +24,8 @@
@handleSizeChange="Refresh"
:handleButton="handleButton"
@selection-change="selection => emitEvent('selection-change', selection)"
@row-click="(row, event, column) => emitEvent('row-click', row, event, column)">
@row-click="(row, event, column) => emitEvent('row-click', row, event, column)"
:showColumnIndex="showColumnIndex">
<template slot="handleButton"
slot-scope="scope">
<v-btn :key="index"
Expand Down
4 changes: 4 additions & 0 deletions src/components/CrudTable/components/props.js
Original file line number Diff line number Diff line change
Expand Up @@ -71,4 +71,8 @@ export default {
type: Array,
default: () => [],
},
showColumnIndex: {
type: Boolean,
default: false,
},
};

0 comments on commit 26624cd

Please sign in to comment.