resolver-egretimp-plus 0.1.76 → 0.1.77

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": "resolver-egretimp-plus",
3
- "version": "0.1.76",
3
+ "version": "0.1.77",
4
4
  "description": "交付体验渲染",
5
5
  "main": "./dist/web/index.js",
6
6
  "module": "./dist/web/index.js",
@@ -11,13 +11,15 @@ useConfigLoad(props.config)
11
11
  const attrs = useAttrs()
12
12
  const tabProps = computed(() => {
13
13
  return {
14
- label: props?.config?.hidden == '1' ?
15
- '' :
16
- lang.value.indexOf('zh') > -1 ? props.config?.metaNameZh : props.config?.metaNameEn,
14
+ label: lang.value.indexOf('zh') > -1 ? props.config?.metaNameZh : props.config?.metaNameEn,
15
+ // label: props?.config?.hidden == '1' ?
16
+ // '' :
17
+ // lang.value.indexOf('zh') > -1 ? props.config?.metaNameZh : props.config?.metaNameEn,
17
18
  name: props.config?.metaCode,
18
- disabled: props?.config?.hidden == '1' ?
19
- true :
20
- props.config?.editFlag == '0'
19
+ disabled: props.config?.editFlag == '0'
20
+ // disabled: props?.config?.hidden == '1' ?
21
+ // true :
22
+ // props.config?.editFlag == '0'
21
23
  }
22
24
  })
23
25
  const modelValue = defineModel()
@@ -1,6 +1,6 @@
1
1
  <script setup>
2
- import { computed, inject, useAttrs } from 'vue'
3
- import { commonPropsType, hasOwn } from '../../utils/index.js'
2
+ import { computed, inject, nextTick, onMounted, ref, useAttrs, watch } from 'vue'
3
+ import { commonPropsType, getUuid, hasOwn } from '../../utils/index.js'
4
4
  import Renderer from '../../renderer.jsx'
5
5
  import CustomComponentTabPaneH5 from './CustomComponentTabPaneH5.vue'
6
6
 
@@ -8,28 +8,34 @@ const props = defineProps({
8
8
  ...commonPropsType,
9
9
  })
10
10
 
11
+ const uuid = getUuid()
11
12
  const lang = inject('lang')
12
13
  const attrs = useAttrs()
13
14
  const modelValue = defineModel()
14
15
  const tabpanes = computed(() => {
15
- return [...(props.config.pmPageMetaList || []).filter(item => item.hidden != '1'), ...(props.config.pmPageMetaList || []).filter(item => item.hidden == '1')]
16
+ return props.config.pmPageMetaList || []
17
+ })
18
+ const tabpanesOfHidden = computed(() => {
19
+ return tabpanes.value?.map(item => item.hidden)
16
20
  })
17
21
 
22
+ const activeNameModel = ref(null)
18
23
  const activeNames = computed({
19
24
  get() {
20
- const currentTab = tabpanes.value.find(tab => tab.defaultShowFlag == '1')
21
- const currentCycleTab = tabpanes.value.find(tab => tab.currentCode)
25
+ const showTabpanes = tabpanes.value.filter(item => item.hidden != '1')
26
+ const currentTab = showTabpanes.find(tab => tab.defaultShowFlag == '1')
27
+ const currentCycleTab = showTabpanes.find(tab => tab.currentCode)
22
28
  if (currentTab) {
23
29
  return currentTab?.isCycle == '1' ? `${currentTab.metaCode}-0` : currentTab.metaCode
24
30
  }
25
31
  if (currentCycleTab) {
26
32
  return currentCycleTab.currentCode
27
33
  }
28
- if (tabpanes.value[0]) {
29
- if (assertMetaType(tabpanes.value[0], 'CustomComponentCycleTabPaneH5') || tabpanes.value[0]?.isCycle == '1') {
30
- return `${tabpanes.value[0].metaCode}-0`
34
+ if (showTabpanes[0]) {
35
+ if (assertMetaType(showTabpanes[0], 'CustomComponentCycleTabPaneH5') || showTabpanes[0]?.isCycle == '1') {
36
+ return `${showTabpanes[0].metaCode}-0`
31
37
  } else {
32
- return tabpanes.value[0].metaCode
38
+ return showTabpanes[0].metaCode
33
39
  }
34
40
  }
35
41
  },
@@ -54,7 +60,7 @@ const activeNames = computed({
54
60
  })
55
61
  const tabProps = computed(() => {
56
62
  return {
57
- activekey: activeNames.value,
63
+ activekey: activeNameModel.value || activeNames.value,
58
64
  sticky: props.config?.sticky == '1',
59
65
  offsettop: (props.config?.offsetTop || '0') + 'vw',
60
66
  type: props.config.displayType || props.config.tabType,
@@ -90,13 +96,45 @@ const customClass = computed(() => {
90
96
  function assertMetaType(config, metaType) {
91
97
  return config.renderby === metaType || config.metaType === metaType
92
98
  }
99
+
100
+ onMounted(() => {
101
+ // 控制 nav 头 可以支持设置hidden的时候的效果 ====start====
102
+ watch(() => props.config._componentLoad, (val) => {
103
+ setTimeout(() => {
104
+ if (val) {
105
+ watch(tabpanesOfHidden, (hids) => {
106
+ const navList = document.getElementById(uuid)?.shadowRoot?.querySelectorAll('cmi-tab-nav')
107
+ hids?.forEach((hidden, idx) => {
108
+ if (navList?.[idx]?.style) {
109
+ if (hidden == '1') {
110
+ navList[idx].style.display = 'none'
111
+ } else {
112
+ navList[idx].style.display = 'inline-flex'
113
+ }
114
+ }
115
+ })
116
+
117
+ activeNameModel.value = 'void'
118
+ nextTick(() => {
119
+ activeNameModel.value = null
120
+ })
121
+ }, {
122
+ immediate: true
123
+ })
124
+ }
125
+ }, 300);
126
+ }, {
127
+ immediate: true
128
+ })
129
+ // 控制 nav 头 可以支持设置hidden的时候的效果 ====end====
130
+ })
93
131
  </script>
94
132
 
95
133
  <template>
96
- <cmi-tabs :class="customClass" v-bind="{...attrs, ...tabProps}">
97
- <CustomComponentTabPaneH5
98
- v-for="tabpane in tabpanes" :config="tabpane" :key="tabpane.metaId"
99
- >
134
+ <cmi-tabs :id="uuid" :class="customClass" v-bind="{...attrs, ...tabProps}">
135
+ <!-- <Renderer :config="tabpanes" v-model="modelValue"></Renderer> -->
136
+ <!-- 只能用下面这种方式写,移动端这个组件 内容嵌套多层级,就显示不出来 -->
137
+ <CustomComponentTabPaneH5 v-for="tabpane in tabpanes" :config="tabpane" :key="tabpane.metaId">
100
138
  <Renderer :config="tabpane?.pmPageMetaList || []" :additionConfigs="[tabpane]" :modelValue="getValue(tabpane.metaCode)" @update:modelValue="(val) => { onUpdateModelValue(val, tabpane.metaCode) }"></Renderer>
101
139
  </CustomComponentTabPaneH5>
102
140
  </cmi-tabs>