sh-view 2.3.0 → 2.4.0

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/package.json CHANGED
@@ -1,6 +1,6 @@
1
1
  {
2
2
  "name": "sh-view",
3
- "version": "2.3.0",
3
+ "version": "2.4.0",
4
4
  "description": "基于vxe-table二次封装",
5
5
  "main": "packages/index.js",
6
6
  "scripts": {
@@ -123,6 +123,7 @@ export default function (props, context, proxy, isForm) {
123
123
  formItemsArr.forEach(item => {
124
124
  item.visible = true
125
125
  item.itemRender.props.disabled = false
126
+ item.slots = undefined
126
127
  })
127
128
  }
128
129
  formOriginItems.value = $vUtils.clone(formItemsArr, true)
@@ -1,16 +1,5 @@
1
- <template>
2
- <vxe-colgroup v-if="isGroup" v-bind="groupConfig">
3
- <template v-for="(child, childIndex) in column.children" :key="childIndex">
4
- <sh-column :column="child" />
5
- </template>
6
- </vxe-colgroup>
7
- <vxe-column v-else v-bind="columnConfig">
8
- <template v-if="column.slots">{{ renderSlots }}</template>
9
- </vxe-column>
10
- </template>
11
-
12
1
  <script>
13
- import { computed, defineComponent, getCurrentInstance, inject, ref } from 'vue'
2
+ import { computed, defineComponent, getCurrentInstance, h, inject, ref, resolveComponent, renderSlot } from 'vue'
14
3
  import { turnColumnItemFilters } from '../js/tableMethods'
15
4
  export default defineComponent({
16
5
  name: 'ShColumn',
@@ -43,18 +32,32 @@ export default defineComponent({
43
32
  const groupConfig = computed(() => {
44
33
  return $vUtils.omit(columnConfig.value, ['children', 'cellRender', 'editRender'])
45
34
  })
46
- const renderSlots = () => {
47
- return Object.keys(column.slots).map(slotKey => {
48
- return shTable.slots[slotKey]
49
- })
35
+ const renderVN = () => {
36
+ let columnSlots = {}
37
+ if (props.column.slots) {
38
+ Object.keys(props.column.slots).map(key => {
39
+ columnSlots[key] = shTable.slots[props.column.slots[key]]
40
+ })
41
+ }
42
+ if (isGroup.value) {
43
+ let childrenList = props.column.children.map(child => {
44
+ return h(resolveComponent('sh-column'), { column: child })
45
+ })
46
+ columnSlots.default = () => childrenList
47
+ return h(resolveComponent('vxe-colgroup'), { ...groupConfig.value }, columnSlots)
48
+ }
49
+ return h(resolveComponent('vxe-column'), { ...columnConfig.value }, columnSlots)
50
50
  }
51
51
 
52
52
  return {
53
53
  isGroup,
54
54
  columnConfig,
55
55
  groupConfig,
56
- renderSlots
56
+ renderVN
57
57
  }
58
+ },
59
+ render() {
60
+ return this.renderVN()
58
61
  }
59
62
  })
60
63
  </script>