wkjp-list-page 1.0.19 → 1.0.20

This diff represents the content of publicly available package versions that have been released to one of the supported registries. The information contained in this diff is provided for informational purposes only and reflects changes between package versions as they appear in their respective public registries.
package/README.md CHANGED
@@ -329,7 +329,7 @@ deviceListTransformList(list) {
329
329
  ## 6. columns 列(常用)
330
330
 
331
331
  非 `slot` 列会 **透传** 到 `el-table-column`(`prop`、`label`、`width`、`fixed` 等)。
332
- 内置列类型 **`selection` / `index` / `expand`** 不做自定义单元格包装。
332
+ 内置列类型 **`selection` / `index`** 不做自定义单元格包装;**`expand`** 可写 **`type: 'expand'` + `slot`**,用父组件具名插槽渲染展开行内容。
333
333
 
334
334
  最简写法:**`{ prop: 'name', label: '姓名' }`**,值为 `null` / `undefined` / `''`(以及 `textFormatter` 得到空串)时,默认显示 **`--`**;表格上 **`cell-empty-text`** 可改全局占位;列上 **`emptyText`**(优先)或 **`defaultText`** 可单独改该列。
335
335
 
package/package.json CHANGED
@@ -1,6 +1,6 @@
1
1
  {
2
2
  "name": "wkjp-list-page",
3
- "version": "1.0.19",
3
+ "version": "1.0.20",
4
4
  "description": "Vue2 + ElementUI CommonListPage component",
5
5
  "main": "src/index.js",
6
6
  "module": "src/index.js",
@@ -109,7 +109,17 @@
109
109
  >
110
110
  <template v-for="(col, idx) in visibleColumns">
111
111
  <el-table-column
112
- v-if="col.type !== 'slot' && isBuiltinCellColumn(col)"
112
+ v-if="col.type === 'expand' && col.slot"
113
+ :key="'col-expand-' + idx + '-' + col.slot"
114
+ type="expand"
115
+ v-bind="tableColumnBind(omitExpandSlotMeta(col))"
116
+ >
117
+ <template slot-scope="scope">
118
+ <slot :name="col.slot" :row="scope.row" :scope="scope"></slot>
119
+ </template>
120
+ </el-table-column>
121
+ <el-table-column
122
+ v-else-if="col.type !== 'slot' && isBuiltinCellColumn(col)"
113
123
  :key="'col-builtin-' + idx + '-' + col.type"
114
124
  v-bind="tableColumnBind(col)"
115
125
  />
@@ -829,6 +839,11 @@ export default {
829
839
  }
830
840
  return display;
831
841
  },
842
+ omitExpandSlotMeta(col) {
843
+ const rest = Object.assign({}, col);
844
+ delete rest.slot;
845
+ return rest;
846
+ },
832
847
  omitSlotType(col) {
833
848
  const rest = Object.assign({}, col);
834
849
  delete rest.type;