diff --git a/dev/App.vue b/dev/App.vue index 090b4ee..5ebf694 100644 --- a/dev/App.vue +++ b/dev/App.vue @@ -13,7 +13,7 @@ diff --git a/package.json b/package.json index 6cb1e4f..4430669 100644 --- a/package.json +++ b/package.json @@ -1,7 +1,7 @@ { "name": "egrid", "description": "element-ui table packaging", - "version": "1.0.1", + "version": "1.0.2", "author": "芊野 ", "private": false, "repository": { diff --git a/src/main.vue b/src/main.vue index 4002124..bc1e987 100644 --- a/src/main.vue +++ b/src/main.vue @@ -4,12 +4,12 @@ v-bind="tableBind" v-on="$listeners"> @@ -46,6 +46,8 @@ const COLUMN_PROPS = { component: Text } +const TYPES = ['selection', 'expand', 'index'] + const COLUMN_KEY_MAP = { label: 'label', prop: 'prop' @@ -87,11 +89,7 @@ export default { }, computed: { - showSelectionIndex () { - return this.columnType === 'selection' || this.columnType === 'index' - }, - - // 处理 $attrs 里面 Boolean 类型的 prop 和,统一 prop 命名 + // 处理 $attrs 里面 Boolean 类型的 prop 和统一 prop 命名 tableBind () { const { $attrs } = this const bind = {} @@ -123,12 +121,12 @@ export default { }, columnTypes () { - const type = this.columnType + const { columnType: type } = this if (!type) return [] - if (typeof type === 'string') { + if (typeof type === 'string' && ~TYPES.indexOf(type)) { return [type] } - return Array.isArray(type) ? type : [] + return Array.isArray(type) && type.filter(it => ~TYPES.indexOf(it)) || [] } },