@didaoktv/didaoui-uniapp 1.4.2 → 2.0.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.
Files changed (44) hide show
  1. package/README.md +2 -2
  2. package/components/dd-action-sheet/dd-action-sheet.vue +4 -3
  3. package/components/dd-alert/dd-alert.vue +4 -3
  4. package/components/dd-backtop/dd-backtop.vue +3 -2
  5. package/components/dd-badge/dd-badge.vue +3 -1
  6. package/components/dd-barcode/dd-barcode.vue +5 -1
  7. package/components/dd-car-keyboard/dd-car-keyboard.vue +0 -2
  8. package/components/dd-cascader/dd-cascader.vue +0 -6
  9. package/components/dd-coupon/dd-coupon.vue +8 -6
  10. package/components/dd-cropper/dd-cropper.vue +19 -8
  11. package/components/dd-date-picker/dd-date-picker.vue +4 -4
  12. package/components/dd-drawer/dd-drawer.vue +4 -3
  13. package/components/dd-dropdown-item/dd-dropdown-item.vue +4 -4
  14. package/components/dd-dropdown-menu/dd-dropdown-menu.vue +9 -10
  15. package/components/dd-goods-card/dd-goods-card.vue +261 -0
  16. package/components/dd-keyboard/dd-keyboard.vue +0 -2
  17. package/components/dd-keyboard/keyboard.js +0 -1
  18. package/components/dd-keyboard/props.js +0 -5
  19. package/components/dd-loading/dd-loading.vue +4 -3
  20. package/components/dd-mini-program-navbar/dd-mini-program-navbar.vue +4 -2
  21. package/components/dd-modal/dd-modal.vue +5 -4
  22. package/components/dd-navigation/dd-navigation.vue +3 -1
  23. package/components/dd-overlay/dd-overlay.vue +3 -3
  24. package/components/dd-picker/dd-picker.vue +4 -4
  25. package/components/dd-popover/dd-popover.vue +4 -5
  26. package/components/dd-popup/dd-popup.vue +6 -7
  27. package/components/dd-poster/dd-poster.vue +10 -8
  28. package/components/dd-pull-refresh/dd-pull-refresh.vue +4 -4
  29. package/components/dd-qrcode/dd-qrcode.vue +1 -8
  30. package/components/dd-room-card/dd-room-card.vue +3 -2
  31. package/components/dd-segmented-tab/dd-segmented-tab.vue +3 -1
  32. package/components/dd-step/dd-step.vue +6 -2
  33. package/components/dd-sticky/dd-sticky.vue +3 -1
  34. package/components/dd-submit-bar/dd-submit-bar.vue +3 -2
  35. package/components/dd-swipe/dd-swipe.vue +3 -2
  36. package/components/dd-swipe-action/dd-swipe-action.vue +5 -5
  37. package/components/dd-tabbar/dd-tabbar.vue +3 -1
  38. package/components/dd-toast/dd-toast.vue +4 -2
  39. package/components/dd-top-navbar/dd-top-navbar.vue +3 -1
  40. package/index.ts +4 -3
  41. package/libs/config/zIndex.d.ts +7 -7
  42. package/libs/config/zIndex.js +13 -20
  43. package/package.json +1 -1
  44. package/scss/_variables.scss +0 -12
@@ -0,0 +1,261 @@
1
+ <template>
2
+ <view
3
+ class="dd-goods-card"
4
+ :class="[
5
+ `dd-goods-card--${layout}`,
6
+ { 'dd-goods-card--disabled': disabled },
7
+ ]"
8
+ :style="customStyle"
9
+ :hover-class="hoverable ? 'dd-goods-card--hover' : ''"
10
+ :hover-stay-time="120"
11
+ @click="onClick"
12
+ >
13
+ <!-- 缩略图 + 金色角标 -->
14
+ <view class="dd-goods-card__thumb">
15
+ <slot name="thumb">
16
+ <image
17
+ class="dd-goods-card__thumb-img"
18
+ :src="thumb"
19
+ :mode="thumbMode"
20
+ ></image>
21
+ </slot>
22
+ <text v-if="tag" class="dd-goods-card__tag" :style="{ zIndex: zIndexConfig.base }">{{ tag }}</text>
23
+ </view>
24
+
25
+ <!-- 信息区 -->
26
+ <view class="dd-goods-card__body">
27
+ <slot name="default">
28
+ <text v-if="title" class="dd-goods-card__title">{{ title }}</text>
29
+ <text v-if="desc" class="dd-goods-card__desc">{{ desc }}</text>
30
+
31
+ <view class="dd-goods-card__price-row">
32
+ <view class="dd-goods-card__price">
33
+ <dd-price
34
+ v-if="price !== undefined && price !== null && price !== ''"
35
+ :rate="price"
36
+ :currency="currency"
37
+ :decimal-length="decimalLength"
38
+ ></dd-price>
39
+ <text v-if="originPrice" class="dd-goods-card__price-origin">
40
+ {{ currency }}{{ originPrice }}
41
+ </text>
42
+ </view>
43
+ <text v-if="num" class="dd-goods-card__num">×{{ num }}</text>
44
+ </view>
45
+
46
+ <view v-if="$slots.bottom" class="dd-goods-card__bottom">
47
+ <slot name="bottom"></slot>
48
+ </view>
49
+ </slot>
50
+ </view>
51
+ </view>
52
+ </template>
53
+
54
+ <script setup lang="ts">
55
+ import DdPrice from '../dd-price/dd-price.vue'
56
+ // z-index 统一取 libs/config/zIndex.js(角标抬到缩略图之上取 base 档)
57
+ import zIndexConfig from '../../libs/config/zIndex.js'
58
+
59
+ interface Props {
60
+ /** 商品图片地址 */
61
+ thumb?: string
62
+ /** 商品名称 */
63
+ title?: string
64
+ /** 商品描述/规格说明 */
65
+ desc?: string
66
+ /** 单价(元,直接展示);不传不渲染 */
67
+ price?: string | number
68
+ /** 划线原价(元,直接展示) */
69
+ originPrice?: string | number
70
+ /** 货币符号 */
71
+ currency?: string
72
+ /** 价格小数位数 */
73
+ decimalLength?: string | number
74
+ /** 角标文案(如「热卖」「售罄」) */
75
+ tag?: string
76
+ /** 布局:horizontal 横向(左图右文)/ vertical 竖向(上图下文) */
77
+ layout?: 'horizontal' | 'vertical'
78
+ /** 已选数量(右下角,不传不渲染) */
79
+ num?: string | number
80
+ /** 置灰(售罄等不可点场景) */
81
+ disabled?: boolean
82
+ /** 图片裁剪模式,透传 image mode */
83
+ thumbMode?: string
84
+ /** 是否启用按压反馈 */
85
+ hoverable?: boolean
86
+ /** 自定义根节点样式 */
87
+ customStyle?: string
88
+ }
89
+
90
+ const props = withDefaults(defineProps<Props>(), {
91
+ thumb: '',
92
+ title: '',
93
+ desc: '',
94
+ price: undefined,
95
+ originPrice: '',
96
+ currency: '¥',
97
+ decimalLength: 2,
98
+ tag: '',
99
+ layout: 'horizontal',
100
+ num: '',
101
+ disabled: false,
102
+ thumbMode: 'aspectFill',
103
+ hoverable: true,
104
+ customStyle: '',
105
+ })
106
+
107
+ const emit = defineEmits<{ (e: 'click', val: Event): void }>()
108
+
109
+ function onClick(e: Event) {
110
+ if (props.disabled) return
111
+ emit('click', e)
112
+ }
113
+ </script>
114
+
115
+ <style lang="scss" scoped>
116
+ @import '../../scss/variables';
117
+ @import '../../scss/mixins';
118
+
119
+ .dd-goods-card {
120
+ display: flex;
121
+ box-sizing: border-box;
122
+ background: var(--dd-bg-elevated, #{$dd-bg-elevated});
123
+ // radius 非可换肤 token,走 SCSS 值(与 dd-card 同口径)
124
+ border-radius: $dd-radius-lg;
125
+ box-shadow: var(--dd-shadow-1, #{$dd-shadow-1});
126
+ overflow: hidden;
127
+ @include dd-transition(all 0.3s ease);
128
+
129
+ &--hover {
130
+ transform: translateY(-4rpx);
131
+ box-shadow: var(--dd-shadow-2, #{$dd-shadow-2});
132
+ }
133
+
134
+ // ponytail: 置灰用整卡降透明度,配合角标「售罄」示意;如需保留文字可读性再改 per-part 置灰
135
+ &--disabled {
136
+ opacity: 0.55;
137
+ }
138
+
139
+ &__thumb {
140
+ position: relative;
141
+ flex-shrink: 0;
142
+ overflow: hidden;
143
+
144
+ &-img {
145
+ display: block;
146
+ width: 100%;
147
+ height: 100%;
148
+ }
149
+ }
150
+
151
+ &__tag {
152
+ position: absolute;
153
+ top: $dd-space-1;
154
+ left: $dd-space-1;
155
+ padding: 2rpx $dd-space-2;
156
+ border-radius: $dd-radius-sm;
157
+ background: linear-gradient(
158
+ 135deg,
159
+ $dd-primary-600,
160
+ var(--dd-primary, #{$dd-primary})
161
+ );
162
+ color: var(--dd-primary-contrast, #{$dd-primary-contrast});
163
+ font-size: 20rpx;
164
+ line-height: 1.4;
165
+ }
166
+
167
+ &__body {
168
+ flex: 1;
169
+ min-width: 0;
170
+ display: flex;
171
+ flex-direction: column;
172
+ }
173
+
174
+ &__title {
175
+ color: var(--dd-text-primary, #{$dd-text-primary});
176
+ font-size: 28rpx;
177
+ font-weight: 600;
178
+ line-height: 1.4;
179
+ @include dd-ellipsis;
180
+ }
181
+
182
+ &__desc {
183
+ margin-top: $dd-space-1;
184
+ color: var(--dd-text-secondary, #{$dd-text-secondary});
185
+ font-size: 24rpx;
186
+ line-height: 1.4;
187
+ // 两行省略
188
+ display: -webkit-box;
189
+ -webkit-box-orient: vertical;
190
+ -webkit-line-clamp: 2;
191
+ overflow: hidden;
192
+ }
193
+
194
+ &__price-row {
195
+ display: flex;
196
+ align-items: center;
197
+ justify-content: space-between;
198
+ margin-top: auto;
199
+ }
200
+
201
+ &__price {
202
+ display: inline-flex;
203
+ align-items: baseline;
204
+ color: var(--dd-error-400, #{$dd-error-400});
205
+ font-weight: 600;
206
+ }
207
+
208
+ &__price-origin {
209
+ margin-left: $dd-space-2;
210
+ color: var(--dd-text-tertiary, #{$dd-text-tertiary});
211
+ font-size: 22rpx;
212
+ font-weight: 400;
213
+ text-decoration: line-through;
214
+ }
215
+
216
+ &__num {
217
+ margin-left: $dd-space-2;
218
+ color: var(--dd-text-tertiary, #{$dd-text-tertiary});
219
+ font-size: 24rpx;
220
+ }
221
+
222
+ &__bottom {
223
+ margin-top: $dd-space-2;
224
+ width: 100%;
225
+ }
226
+ }
227
+
228
+ // 横向:左图右文,图 140rpx 见方
229
+ .dd-goods-card--horizontal {
230
+ padding: $dd-space-3;
231
+
232
+ .dd-goods-card__thumb {
233
+ width: 140rpx;
234
+ height: 140rpx;
235
+ border-radius: $dd-radius-md;
236
+ }
237
+
238
+ .dd-goods-card__body {
239
+ padding-left: $dd-space-3;
240
+ }
241
+
242
+ .dd-goods-card__title {
243
+ @include dd-ellipsis;
244
+ }
245
+ }
246
+
247
+ // 竖向:上图下文,图占满整宽
248
+ .dd-goods-card--vertical {
249
+ flex-direction: column;
250
+ padding: 0;
251
+
252
+ .dd-goods-card__thumb {
253
+ width: 100%;
254
+ aspect-ratio: 1;
255
+ }
256
+
257
+ .dd-goods-card__body {
258
+ padding: $dd-space-3;
259
+ }
260
+ }
261
+ </style>
@@ -7,7 +7,6 @@
7
7
  position="bottom"
8
8
  :safe-area-inset-bottom="safeAreaInsetBottom"
9
9
  @close="popupClose"
10
- :z-index="zIndex"
11
10
  >
12
11
  <view class="dd-keyboard">
13
12
  <slot />
@@ -74,7 +73,6 @@
74
73
  * @property {Boolean} closeOnClickOverlay 是否允许点击遮罩收起键盘 (默认 true )
75
74
  * @property {Boolean} show 控制键盘的弹出与收起(默认 false )
76
75
  * @property {Boolean} overlay 是否显示遮罩 (默认 true )
77
- * @property {String | Number} zIndex 弹出键盘的z-index值 (默认 1075 )
78
76
  * @property {String} cancelText 取消按钮的文字 (默认 '取消' )
79
77
  * @property {String} confirmText 确认按钮的文字 (默认 '确认' )
80
78
  * @property {Object} customStyle 自定义样式,对象形式
@@ -13,7 +13,6 @@ export default {
13
13
  closeOnClickOverlay: true,
14
14
  show: false,
15
15
  overlay: true,
16
- zIndex: 10075,
17
16
  cancelText: '取消',
18
17
  confirmText: '确定'
19
18
  }
@@ -65,11 +65,6 @@ export const props = defineMixin({
65
65
  type: Boolean,
66
66
  default: () => defProps.keyboard.overlay
67
67
  },
68
- // z-index值
69
- zIndex: {
70
- type: [String, Number],
71
- default: () => defProps.keyboard.zIndex
72
- },
73
68
  // 取消按钮的文字
74
69
  cancelText: {
75
70
  type: String,
@@ -1,9 +1,9 @@
1
1
  <template>
2
2
  <!-- 仅全屏分支传送;inline 分支必须留在原位(传送会破坏布局流) -->
3
3
  <dd-portal v-if="fullscreen">
4
- <view class="dd-loading dd-loading--fullscreen" :style="{ zIndex: 9999 }">
4
+ <view class="dd-loading dd-loading--fullscreen" :style="{ zIndex: zIndexConfig.loading }">
5
5
  <view class="dd-loading__mask"></view>
6
- <view class="dd-loading__box">
6
+ <view class="dd-loading__box" :style="{ zIndex: zIndexConfig.base }">
7
7
  <view class="dd-loading__core" :class="[`dd-loading__core--${type}`, `dd-loading__core--${size}`]" :style="coreStyle">
8
8
  <template v-if="type === 'spinner'">
9
9
  <view class="dd-loading__spinner"></view>
@@ -40,6 +40,8 @@
40
40
  <script setup lang="ts">
41
41
  import { computed } from 'vue'
42
42
  import DdPortal from '../dd-portal/dd-portal.vue'
43
+ // z-index 统一取 libs/config/zIndex.js(压过 dialog/popup,但不压 toast)
44
+ import zIndexConfig from '../../libs/config/zIndex.js'
43
45
 
44
46
  interface Props {
45
47
  type?: 'spinner' | 'dots' | 'pulse'
@@ -93,7 +95,6 @@ const coreStyle = computed(() => (props.color ? { '--dd-loading-color': props.co
93
95
 
94
96
  &__box {
95
97
  position: relative;
96
- z-index: 1;
97
98
  display: flex;
98
99
  flex-direction: column;
99
100
  align-items: center;
@@ -51,6 +51,8 @@
51
51
  <script setup lang="ts">
52
52
  import { computed, onMounted, ref } from 'vue'
53
53
  import DdIcon from '../dd-icon/dd-icon.vue'
54
+ // z-index 统一取 libs/config/zIndex.js(自定义导航吸顶层级取 sticky 档)
55
+ import zIndexConfig from '../../libs/config/zIndex.js'
54
56
 
55
57
  interface Props {
56
58
  variant?: 'default' | 'search' | 'custom'
@@ -121,7 +123,7 @@ function info_windowWidth(): number {
121
123
  }
122
124
  }
123
125
 
124
- const navStyle = computed(() => ({}))
126
+ const navStyle = computed(() => ({ zIndex: zIndexConfig.sticky }))
125
127
 
126
128
  const placeholderStyle = 'color: #9E9E9E; font-size: 14px;'
127
129
 
@@ -146,7 +148,7 @@ function onSearchConfirm(e: any) {
146
148
  @include dd-glass;
147
149
  border-bottom: 1px solid var(--dd-glass-border, #{$dd-glass-border});
148
150
  position: relative;
149
- z-index: $dd-z-index-fixed;
151
+ /* z-index 由模板注入(libs/config/zIndex.js sticky 档) */
150
152
 
151
153
  &--transparent {
152
154
  background: transparent !important;
@@ -10,6 +10,7 @@ let activeModalClose: (() => void) | null = null
10
10
  v-if="visible"
11
11
  class="dd-modal__mask"
12
12
  :class="{ 'dd-modal__mask--show': showClass }"
13
+ :style="{ zIndex: zIndexConfig.dialogMask }"
13
14
  @click="onMaskClick"
14
15
  ></view>
15
16
 
@@ -18,7 +19,7 @@ let activeModalClose: (() => void) | null = null
18
19
  v-if="visible && type === 'dialog'"
19
20
  class="dd-modal__dialog"
20
21
  :class="{ 'dd-modal__dialog--show': showClass }"
21
- :style="{ width: widthValue }"
22
+ :style="{ width: widthValue, zIndex: zIndexConfig.dialog }"
22
23
  >
23
24
  <view v-if="$slots.header || title" class="dd-modal__header">
24
25
  <slot name="header">
@@ -41,6 +42,7 @@ let activeModalClose: (() => void) | null = null
41
42
  v-else-if="visible"
42
43
  class="dd-modal__sheet"
43
44
  :class="{ 'dd-modal__sheet--show': showClass }"
45
+ :style="{ zIndex: zIndexConfig.dialog }"
44
46
  >
45
47
  <view class="dd-modal__handle"></view>
46
48
  <view v-if="$slots.header || title" class="dd-modal__header">
@@ -64,6 +66,8 @@ let activeModalClose: (() => void) | null = null
64
66
  import { computed, ref, watch, onUnmounted, nextTick } from 'vue'
65
67
  import DdPortal from '../dd-portal/dd-portal.vue'
66
68
  import DdIcon from '../dd-icon/dd-icon.vue'
69
+ // z-index 统一取 libs/config/zIndex.js(对话框族与 dd-dialog 同档:dialogMask/dialog)
70
+ import zIndexConfig from '../../libs/config/zIndex.js'
67
71
 
68
72
  interface Props {
69
73
  modelValue?: boolean
@@ -177,7 +181,6 @@ onUnmounted(() => {
177
181
  backdrop-filter: blur(8px);
178
182
  -webkit-backdrop-filter: blur(8px);
179
183
  opacity: 0;
180
- z-index: 1000;
181
184
  transition: opacity 0.25s ease;
182
185
 
183
186
  &--show {
@@ -192,7 +195,6 @@ onUnmounted(() => {
192
195
  left: 50%;
193
196
  transform: translate(-50%, -50%) scale(0.9);
194
197
  opacity: 0;
195
- z-index: 1001;
196
198
  max-width: 720rpx; // 360px 上限
197
199
  max-height: 80vh;
198
200
  background: var(--dd-bg-popup, #{$dd-bg-popup});
@@ -217,7 +219,6 @@ onUnmounted(() => {
217
219
  right: 0;
218
220
  bottom: 0;
219
221
  transform: translateY(100%);
220
- z-index: 1001;
221
222
  max-height: 85vh;
222
223
  background: var(--dd-bg-popup, #{$dd-bg-popup});
223
224
  border: 1px solid var(--dd-border-default, #{$dd-border-default});
@@ -5,6 +5,7 @@
5
5
  'dd-nav--fixed': fixed,
6
6
  'dd-nav--border': border,
7
7
  }"
8
+ :style="{ zIndex: zIndexConfig.sticky }"
8
9
  >
9
10
  <view
10
11
  v-for="(item, index) in items"
@@ -27,6 +28,8 @@
27
28
 
28
29
  <script setup lang="ts">
29
30
  import DdIcon from '../dd-icon/dd-icon.vue'
31
+ // z-index 统一取 libs/config/zIndex.js(fixed 时吸底层级取 sticky 档;非 fixed 时为 static,z-index 天然失效)
32
+ import zIndexConfig from '../../libs/config/zIndex.js'
30
33
 
31
34
  interface NavItem {
32
35
  icon: string
@@ -83,7 +86,6 @@ function onSelect(index: number) {
83
86
  left: 0;
84
87
  right: 0;
85
88
  bottom: 0;
86
- z-index: $dd-z-index-sticky;
87
89
  @include dd-safe-area-bottom;
88
90
  }
89
91
 
@@ -3,7 +3,7 @@
3
3
  <view
4
4
  class="dd-overlay"
5
5
  :class="{ 'dd-overlay--show': modelValue }"
6
- :style="{ zIndex: zIndex, '--dd-overlay-duration': `${duration}s` }"
6
+ :style="{ zIndex: zIndexConfig.overlay, '--dd-overlay-duration': `${duration}s` }"
7
7
  @click="onClick"
8
8
  @touchmove="onTouchMove"
9
9
  @touchmove.stop.prevent="onTouchMove"
@@ -16,11 +16,12 @@
16
16
  <script setup lang="ts">
17
17
  import { watch } from 'vue'
18
18
  import DdPortal from '../dd-portal/dd-portal.vue'
19
+ // z-index 统一取 libs/config/zIndex.js(overlay 遮罩档,不对外暴露)
20
+ import zIndexConfig from '../../libs/config/zIndex.js'
19
21
 
20
22
  interface Props {
21
23
  modelValue?: boolean
22
24
  lockScroll?: boolean
23
- zIndex?: number
24
25
  duration?: number
25
26
  closeOnClickOverlay?: boolean
26
27
  }
@@ -28,7 +29,6 @@ interface Props {
28
29
  const props = withDefaults(defineProps<Props>(), {
29
30
  modelValue: false,
30
31
  lockScroll: true,
31
- zIndex: 2000,
32
32
  duration: 0.3,
33
33
  closeOnClickOverlay: true,
34
34
  })
@@ -1,8 +1,8 @@
1
1
  <template>
2
2
  <dd-portal>
3
3
  <view class="dd-picker" :class="{ 'dd-picker--open': show }">
4
- <view class="dd-picker__mask" @click="onMaskClick"></view>
5
- <view class="dd-picker__sheet">
4
+ <view class="dd-picker__mask" :style="{ zIndex: zIndexConfig.overlay }" @click="onMaskClick"></view>
5
+ <view class="dd-picker__sheet" :style="{ zIndex: zIndexConfig.popup }">
6
6
  <view class="dd-picker__toolbar">
7
7
  <text class="dd-picker__cancel" @click="onCancel">取消</text>
8
8
  <text class="dd-picker__title">{{ title }}</text>
@@ -33,6 +33,8 @@
33
33
  <script setup lang="ts">
34
34
  import { computed, ref, watch } from 'vue'
35
35
  import DdPortal from '../dd-portal/dd-portal.vue'
36
+ // z-index 统一取 libs/config/zIndex.js(picker 底部面板:overlay/popup 档)
37
+ import zIndexConfig from '../../libs/config/zIndex.js'
36
38
 
37
39
  interface PickerItem {
38
40
  text: string
@@ -146,7 +148,6 @@ function onConfirm() {
146
148
  &__mask {
147
149
  position: fixed;
148
150
  inset: 0;
149
- z-index: $dd-z-index-overlay;
150
151
  background: var(--dd-color-overlay-strong, #{$dd-color-overlay-strong});
151
152
  opacity: 0;
152
153
  pointer-events: none;
@@ -158,7 +159,6 @@ function onConfirm() {
158
159
  left: 0;
159
160
  right: 0;
160
161
  bottom: 0;
161
- z-index: $dd-z-index-popup;
162
162
  background: var(--dd-bg-popup, #{$dd-bg-popup});
163
163
  border-radius: $dd-radius-lg $dd-radius-lg 0 0;
164
164
  transform: translateY(100%);
@@ -25,6 +25,8 @@
25
25
 
26
26
  <script setup lang="ts">
27
27
  import { computed, provide } from 'vue'
28
+ // z-index 统一取 libs/config/zIndex.js(透明点击遮罩 overlay 档、面板 popup 档,不对外暴露)
29
+ import zIndexConfig from '../../libs/config/zIndex.js'
28
30
 
29
31
  interface Props {
30
32
  modelValue?: boolean
@@ -33,7 +35,6 @@ interface Props {
33
35
  closeOnClickAction?: boolean
34
36
  closeOnClickOverlay?: boolean
35
37
  offset?: number
36
- zIndex?: number
37
38
  }
38
39
 
39
40
  const props = withDefaults(defineProps<Props>(), {
@@ -43,7 +44,6 @@ const props = withDefaults(defineProps<Props>(), {
43
44
  closeOnClickAction: true,
44
45
  closeOnClickOverlay: true,
45
46
  offset: 16,
46
- zIndex: 2000,
47
47
  })
48
48
 
49
49
  const emit = defineEmits<{
@@ -53,11 +53,11 @@ const emit = defineEmits<{
53
53
  (e: 'close'): void
54
54
  }>()
55
55
 
56
- const maskZIndex = computed(() => props.zIndex - 1)
56
+ const maskZIndex = zIndexConfig.overlay
57
57
 
58
58
  const panelStyle = computed(() => {
59
59
  const offsetRpx = `${props.offset}rpx`
60
- const s: Record<string, string> = { zIndex: String(props.zIndex) }
60
+ const s: Record<string, string> = { zIndex: String(zIndexConfig.popup) }
61
61
  // 偏移通过 margin 表达,避免覆盖 transform
62
62
  if (props.placement === 'top') s.marginBottom = offsetRpx
63
63
  if (props.placement === 'bottom') s.marginTop = offsetRpx
@@ -118,7 +118,6 @@ provide('ddPopover', {
118
118
  border-radius: $dd-radius-lg;
119
119
  box-shadow: var(--dd-shadow-2, #{$dd-shadow-2});
120
120
  overflow: visible;
121
- z-index: 2000;
122
121
 
123
122
  &--light {
124
123
  background: var(--dd-bg-popup, #{$dd-bg-popup});
@@ -19,7 +19,7 @@
19
19
  ]"
20
20
  :style="panelStyle"
21
21
  >
22
- <view v-if="closeable" class="dd-popup__close" :class="`dd-popup__close--${closeIconPosition}`" @click="onCloseIcon">
22
+ <view v-if="closeable" class="dd-popup__close" :class="`dd-popup__close--${closeIconPosition}`" :style="{ zIndex: zIndexConfig.base + 1 }" @click="onCloseIcon">
23
23
  <dd-icon name="cross" />
24
24
  </view>
25
25
  <view v-if="position === 'bottom' && safeAreaInsetBottom" class="dd-popup__safe-bottom"></view>
@@ -33,6 +33,8 @@
33
33
  import { computed, ref, watch, onUnmounted, nextTick } from 'vue'
34
34
  import DdIcon from '../dd-icon/dd-icon.vue'
35
35
  import DdPortal from '../dd-portal/dd-portal.vue'
36
+ // z-index 统一取 libs/config/zIndex.js(遮罩 overlay 档、面板 popup 档,不对外暴露)
37
+ import zIndexConfig from '../../libs/config/zIndex.js'
36
38
 
37
39
  interface Props {
38
40
  modelValue?: boolean
@@ -46,7 +48,6 @@ interface Props {
46
48
  width?: string
47
49
  height?: string
48
50
  closeOnClickOverlay?: boolean
49
- zIndex?: number
50
51
  }
51
52
 
52
53
  const props = withDefaults(defineProps<Props>(), {
@@ -61,7 +62,6 @@ const props = withDefaults(defineProps<Props>(), {
61
62
  width: '',
62
63
  height: '',
63
64
  closeOnClickOverlay: true,
64
- zIndex: 2000,
65
65
  })
66
66
 
67
67
  const emit = defineEmits<{
@@ -74,12 +74,12 @@ const emit = defineEmits<{
74
74
  (e: 'click-close-icon'): void
75
75
  }>()
76
76
 
77
- const overlayZIndex = computed(() => props.zIndex)
78
- const panelZIndex = computed(() => props.zIndex + 1)
77
+ const overlayZIndex = zIndexConfig.overlay
78
+ const panelZIndex = zIndexConfig.popup
79
79
 
80
80
  const panelStyle = computed(() => {
81
81
  const s: Record<string, string> = {
82
- zIndex: String(panelZIndex.value),
82
+ zIndex: String(panelZIndex),
83
83
  }
84
84
  if (props.width && (props.position === 'left' || props.position === 'right')) {
85
85
  s.width = props.width
@@ -232,7 +232,6 @@ onUnmounted(() => {
232
232
  color: var(--dd-text-tertiary, #{$dd-text-tertiary});
233
233
  font-size: 44rpx;
234
234
  @include dd-flex-center;
235
- z-index: 2;
236
235
 
237
236
  &--top-left { top: $dd-space-2; left: $dd-space-2; }
238
237
  &--top-right { top: $dd-space-2; right: $dd-space-2; }
@@ -1,10 +1,11 @@
1
1
  <template>
2
2
  <view class="dd-poster">
3
3
  <!-- canvas用于绘制海报 -->
4
- <view v-if="showCanvas" class="dd-poster__renderer">
4
+ <view v-if="showCanvas" class="dd-poster__renderer" :style="{ zIndex: zcBase }">
5
5
  <dd-canvas
6
6
  ref="posterCanvas"
7
7
  class="dd-poster__hidden-canvas"
8
+ :style="{ zIndex: zcBase }"
8
9
  :canvas-id="canvasId"
9
10
  :width="canvasWidth"
10
11
  :height="canvasHeight"
@@ -13,7 +14,7 @@
13
14
  </dd-canvas>
14
15
  </view>
15
16
  <!-- 隐藏的二维码组件,用于生成二维码图片 -->
16
- <view class="dd-poster__renderer">
17
+ <view class="dd-poster__renderer" :style="{ zIndex: zcBase }">
17
18
  <dd-qrcode
18
19
  ref="qrCode"
19
20
  :val="qrCodeValue"
@@ -24,6 +25,7 @@
24
25
  background="#ffffff"
25
26
  foreground="#000000"
26
27
  :class="['dd-poster__hidden-qrcode', qrCodeShow ? '' : 'dd-poster__hidden-qrcode--hidden']"
28
+ :style="{ zIndex: zcBase }"
27
29
  />
28
30
  </view>
29
31
  </view>
@@ -48,6 +50,8 @@
48
50
  import {
49
51
  rpx2px
50
52
  } from '../../libs/function/index.js';
53
+ // z-index 统一取 libs/config/zIndex.js(离屏隐藏容器归 base 档,Options API 经 data 暴露给模板)
54
+ import zIndexConfig from '../../libs/config/zIndex.js';
51
55
  export default {
52
56
  name: 'dd-poster',
53
57
  props: {
@@ -58,6 +62,8 @@ export default {
58
62
  },
59
63
  data() {
60
64
  return {
65
+ // 离屏隐藏容器层级(base 档)
66
+ zcBase: zIndexConfig.base,
61
67
  canvasId: 'dd-poster-canvas-' + Date.now(),
62
68
  showCanvas: false,
63
69
  canvasWidth: 0,
@@ -656,7 +662,6 @@ export default {
656
662
  width: 1px;
657
663
  height: 1px;
658
664
  overflow: hidden;
659
- z-index: -1;
660
665
  opacity: 0.01;
661
666
  pointer-events: none;
662
667
  }
@@ -670,22 +675,19 @@ export default {
670
675
  width: 1px;
671
676
  height: 1px;
672
677
  overflow: hidden;
673
- z-index: -1;
674
678
  }
675
679
 
676
680
  &__hidden-canvas {
677
681
  position: fixed;
678
682
  top: -10000px;
679
683
  left: -10000px;
680
- z-index: -1;
681
684
  }
682
-
685
+
683
686
  &__hidden-qrcode {
684
687
  position: fixed;
685
688
  top: -10000px;
686
689
  left: -10000px;
687
- z-index: -1;
688
-
690
+
689
691
  &--hidden {
690
692
  display: none;
691
693
  }