@didaoktv/didaoui-uniapp 2.6.0 → 2.7.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/components/dd-cart-bar/dd-cart-bar.vue +62 -109
- package/components/dd-goods-card/dd-goods-card.vue +50 -0
- package/components/dd-package-sku/dd-package-sku.vue +4 -1
- package/components/dd-price/dd-price.vue +32 -1
- package/libs/config/zIndex.js +2 -0
- package/package.json +1 -1
- package/scss/theme.scss +81 -0
|
@@ -49,6 +49,7 @@
|
|
|
49
49
|
@update:model-value="onPopupUpdate"
|
|
50
50
|
@open="emit('open')"
|
|
51
51
|
@close="emit('close')"
|
|
52
|
+
@closed="onPanelClosed"
|
|
52
53
|
>
|
|
53
54
|
<view class="dd-cart-bar__panel">
|
|
54
55
|
<view class="dd-cart-bar__header">
|
|
@@ -67,45 +68,30 @@
|
|
|
67
68
|
scroll-y
|
|
68
69
|
:style="{ maxHeight: maxListHeight }"
|
|
69
70
|
>
|
|
70
|
-
|
|
71
|
+
<!-- 商品行复用 dd-goods-card 小号横卡(96rpx 紧凑图、不渲染描述、价格小一号);规格随卡 desc 传入(sm 档不显示),数量步进器走 price-right 插槽 -->
|
|
72
|
+
<dd-goods-card
|
|
71
73
|
v-for="item in items"
|
|
72
74
|
:key="item.id"
|
|
73
|
-
class="dd-cart-bar__item"
|
|
75
|
+
class="dd-cart-bar__item-card"
|
|
76
|
+
size="sm"
|
|
77
|
+
:thumb="item.image"
|
|
78
|
+
:title="item.name"
|
|
79
|
+
:desc="item.specs"
|
|
80
|
+
:price="item.price / 100"
|
|
81
|
+
:currency="currency"
|
|
74
82
|
@click="emit('item-click', item)"
|
|
75
83
|
>
|
|
76
|
-
<
|
|
77
|
-
|
|
78
|
-
|
|
79
|
-
|
|
80
|
-
|
|
81
|
-
|
|
82
|
-
|
|
83
|
-
|
|
84
|
-
|
|
85
|
-
|
|
86
|
-
|
|
87
|
-
</view>
|
|
88
|
-
<view class="dd-cart-bar__item-info">
|
|
89
|
-
<text class="dd-cart-bar__item-name">{{ item.name }}</text>
|
|
90
|
-
<text v-if="item.specs" class="dd-cart-bar__item-specs">{{ item.specs }}</text>
|
|
91
|
-
<view class="dd-cart-bar__item-footer">
|
|
92
|
-
<dd-price
|
|
93
|
-
class="dd-cart-bar__item-price"
|
|
94
|
-
:rate="item.price / 100"
|
|
95
|
-
:currency="currency"
|
|
96
|
-
/>
|
|
97
|
-
<!-- 减到 1 再减由 onMinus 移除该项(min=1 时 stepper 只发 minus 不发 change) -->
|
|
98
|
-
<dd-stepper
|
|
99
|
-
:model-value="item.count"
|
|
100
|
-
:min="1"
|
|
101
|
-
size="sm"
|
|
102
|
-
@click.stop
|
|
103
|
-
@change="onCountChange(item, $event)"
|
|
104
|
-
@minus="onMinus(item)"
|
|
105
|
-
/>
|
|
106
|
-
</view>
|
|
107
|
-
</view>
|
|
108
|
-
</view>
|
|
84
|
+
<template #price-right>
|
|
85
|
+
<dd-stepper
|
|
86
|
+
:model-value="item.count"
|
|
87
|
+
:min="1"
|
|
88
|
+
size="sm"
|
|
89
|
+
@click.stop
|
|
90
|
+
@change="onCountChange(item, $event)"
|
|
91
|
+
@minus="onMinus(item)"
|
|
92
|
+
/>
|
|
93
|
+
</template>
|
|
94
|
+
</dd-goods-card>
|
|
109
95
|
</scroll-view>
|
|
110
96
|
<view v-else class="dd-cart-bar__empty">
|
|
111
97
|
<dd-icon name="shopping-cart-o" class="dd-cart-bar__empty-icon" />
|
|
@@ -113,15 +99,26 @@
|
|
|
113
99
|
</view>
|
|
114
100
|
</view>
|
|
115
101
|
</dd-popup>
|
|
102
|
+
|
|
103
|
+
<!-- 清空二次确认:库内 dd-dialog(dialog 档 2011,恒高于本组件 popup 面板 2002),不用 uni.showModal(H5 端 z-index 999 会被自家面板盖住) -->
|
|
104
|
+
<dd-dialog
|
|
105
|
+
v-model="clearDialogVisible"
|
|
106
|
+
title="提示"
|
|
107
|
+
message="确定清空购物车吗?"
|
|
108
|
+
confirm-text="确定"
|
|
109
|
+
:show-cancel-button="true"
|
|
110
|
+
@confirm="doClear"
|
|
111
|
+
/>
|
|
116
112
|
</template>
|
|
117
113
|
|
|
118
114
|
<script setup lang="ts">
|
|
119
|
-
import { computed } from 'vue'
|
|
115
|
+
import { computed, ref, watch } from 'vue'
|
|
120
116
|
import type { CSSProperties } from 'vue'
|
|
121
117
|
import DdBadge from '../dd-badge/dd-badge.vue'
|
|
122
118
|
import DdButton from '../dd-button/dd-button.vue'
|
|
119
|
+
import DdDialog from '../dd-dialog/dd-dialog.vue'
|
|
120
|
+
import DdGoodsCard from '../dd-goods-card/dd-goods-card.vue'
|
|
123
121
|
import DdIcon from '../dd-icon/dd-icon.vue'
|
|
124
|
-
import DdImage from '../dd-image/dd-image.vue'
|
|
125
122
|
import DdPopup from '../dd-popup/dd-popup.vue'
|
|
126
123
|
import DdPrice from '../dd-price/dd-price.vue'
|
|
127
124
|
import DdStepper from '../dd-stepper/dd-stepper.vue'
|
|
@@ -144,7 +141,7 @@ interface Props {
|
|
|
144
141
|
title?: string
|
|
145
142
|
/** 清空按钮文案 */
|
|
146
143
|
clearText?: string
|
|
147
|
-
/**
|
|
144
|
+
/** 清空前是否二次确认(库内 dd-dialog) */
|
|
148
145
|
clearConfirm?: boolean
|
|
149
146
|
/** 货币符号 */
|
|
150
147
|
currency?: string
|
|
@@ -170,7 +167,7 @@ interface Props {
|
|
|
170
167
|
|
|
171
168
|
const props = withDefaults(defineProps<Props>(), {
|
|
172
169
|
modelValue: false,
|
|
173
|
-
label: '
|
|
170
|
+
label: '',
|
|
174
171
|
suffixLabel: '',
|
|
175
172
|
tips: '',
|
|
176
173
|
title: '已选商品',
|
|
@@ -207,8 +204,23 @@ const totalYuan = computed(() => props.items.reduce((sum, it) => sum + (it.price
|
|
|
207
204
|
|
|
208
205
|
const buttonDisabled = computed(() => props.disabled || totalCount.value === 0)
|
|
209
206
|
|
|
207
|
+
// 弹层打开时栏抬升到 popup 档 +1,且保持到关闭动画结束(popup 的 closed 事件)才降回 sticky 档:
|
|
208
|
+
// 否则关闭瞬间栏先掉档,下滑中的面板(2001)会盖在栏(100)上面收起
|
|
209
|
+
const barElevated = ref(props.modelValue)
|
|
210
|
+
|
|
211
|
+
watch(
|
|
212
|
+
() => props.modelValue,
|
|
213
|
+
(val) => {
|
|
214
|
+
if (val) barElevated.value = true
|
|
215
|
+
},
|
|
216
|
+
)
|
|
217
|
+
|
|
218
|
+
function onPanelClosed() {
|
|
219
|
+
barElevated.value = false
|
|
220
|
+
}
|
|
221
|
+
|
|
210
222
|
const barStyle = computed<CSSProperties>(() => ({
|
|
211
|
-
zIndex:
|
|
223
|
+
zIndex: barElevated.value ? zIndexConfig.popup + 1 : zIndexConfig.sticky,
|
|
212
224
|
}))
|
|
213
225
|
|
|
214
226
|
const buttonStyle = computed(() => (props.buttonColor ? { background: props.buttonColor } : undefined))
|
|
@@ -240,16 +252,13 @@ function emitChange(items: DdCartItem[]) {
|
|
|
240
252
|
if (items.length === 0 && props.modelValue) emit('update:modelValue', false)
|
|
241
253
|
}
|
|
242
254
|
|
|
255
|
+
/** 清空二次确认弹窗显隐(dd-dialog 在模板尾部独立渲染,经 portal 提到页面根节点) */
|
|
256
|
+
const clearDialogVisible = ref(false)
|
|
257
|
+
|
|
243
258
|
function onClear() {
|
|
244
259
|
if (!props.items.length) return
|
|
245
260
|
if (!props.clearConfirm) return doClear()
|
|
246
|
-
|
|
247
|
-
title: '提示',
|
|
248
|
-
content: '确定清空购物车吗?',
|
|
249
|
-
success: (res) => {
|
|
250
|
-
if (res.confirm) doClear()
|
|
251
|
-
},
|
|
252
|
-
})
|
|
261
|
+
clearDialogVisible.value = true
|
|
253
262
|
}
|
|
254
263
|
|
|
255
264
|
function doClear() {
|
|
@@ -309,7 +318,6 @@ function onSubmit() {
|
|
|
309
318
|
justify-content: center;
|
|
310
319
|
width: 88rpx;
|
|
311
320
|
height: 88rpx;
|
|
312
|
-
transform: translateY(-14rpx);
|
|
313
321
|
border-radius: $dd-radius-full;
|
|
314
322
|
background: var(--dd-primary, #{$dd-primary});
|
|
315
323
|
color: var(--dd-primary-contrast, #{$dd-primary-contrast});
|
|
@@ -365,8 +373,8 @@ function onSubmit() {
|
|
|
365
373
|
|
|
366
374
|
.dd-cart-bar__panel {
|
|
367
375
|
// 底部留出栏高 + 安全区:弹层面板(popup 档)压在栏下方,内容不被栏遮挡
|
|
368
|
-
padding: $dd-space-3 $dd-space-3 calc(100rpx + constant(safe-area-inset-bottom));
|
|
369
|
-
padding: $dd-space-3 $dd-space-3 calc(100rpx + env(safe-area-inset-bottom));
|
|
376
|
+
padding: $dd-space-3 $dd-space-3 calc(100rpx + $dd-space-2*2 + constant(safe-area-inset-bottom));
|
|
377
|
+
padding: $dd-space-3 $dd-space-3 calc(100rpx + $dd-space-2*2 + env(safe-area-inset-bottom));
|
|
370
378
|
box-sizing: border-box;
|
|
371
379
|
}
|
|
372
380
|
|
|
@@ -412,68 +420,13 @@ function onSubmit() {
|
|
|
412
420
|
box-sizing: border-box;
|
|
413
421
|
}
|
|
414
422
|
|
|
415
|
-
|
|
416
|
-
|
|
417
|
-
|
|
418
|
-
|
|
419
|
-
}
|
|
420
|
-
|
|
421
|
-
.dd-cart-bar__item-image {
|
|
422
|
-
flex-shrink: 0;
|
|
423
|
-
margin-right: $dd-space-3;
|
|
424
|
-
overflow: hidden;
|
|
425
|
-
|
|
426
|
-
&--empty {
|
|
427
|
-
display: flex;
|
|
428
|
-
align-items: center;
|
|
429
|
-
justify-content: center;
|
|
430
|
-
width: 120rpx;
|
|
431
|
-
height: 120rpx;
|
|
432
|
-
border-radius: 16rpx;
|
|
433
|
-
background: var(--dd-surface-container-low, #{$dd-surface-container-low});
|
|
423
|
+
// 列表行卡片间距(行本体是 dd-goods-card 小号横卡)
|
|
424
|
+
.dd-cart-bar__item-card {
|
|
425
|
+
& + & {
|
|
426
|
+
margin-top: $dd-space-2;
|
|
434
427
|
}
|
|
435
428
|
}
|
|
436
429
|
|
|
437
|
-
.dd-cart-bar__item-image-icon {
|
|
438
|
-
color: var(--dd-text-secondary, #{$dd-text-secondary});
|
|
439
|
-
font-size: 48rpx;
|
|
440
|
-
}
|
|
441
|
-
|
|
442
|
-
.dd-cart-bar__item-info {
|
|
443
|
-
flex: 1;
|
|
444
|
-
min-width: 0;
|
|
445
|
-
}
|
|
446
|
-
|
|
447
|
-
.dd-cart-bar__item-name {
|
|
448
|
-
display: block;
|
|
449
|
-
overflow: hidden;
|
|
450
|
-
color: var(--dd-text-primary, #{$dd-text-primary});
|
|
451
|
-
font-size: $dd-font-size-body;
|
|
452
|
-
white-space: nowrap;
|
|
453
|
-
text-overflow: ellipsis;
|
|
454
|
-
}
|
|
455
|
-
|
|
456
|
-
.dd-cart-bar__item-specs {
|
|
457
|
-
display: block;
|
|
458
|
-
margin-top: $dd-space-1;
|
|
459
|
-
overflow: hidden;
|
|
460
|
-
color: var(--dd-text-secondary, #{$dd-text-secondary});
|
|
461
|
-
font-size: $dd-font-size-caption;
|
|
462
|
-
white-space: nowrap;
|
|
463
|
-
text-overflow: ellipsis;
|
|
464
|
-
}
|
|
465
|
-
|
|
466
|
-
.dd-cart-bar__item-footer {
|
|
467
|
-
display: flex;
|
|
468
|
-
align-items: center;
|
|
469
|
-
justify-content: space-between;
|
|
470
|
-
margin-top: $dd-space-2;
|
|
471
|
-
}
|
|
472
|
-
|
|
473
|
-
.dd-cart-bar__item-price {
|
|
474
|
-
color: var(--dd-error, #{$dd-error});
|
|
475
|
-
}
|
|
476
|
-
|
|
477
430
|
.dd-cart-bar__empty {
|
|
478
431
|
display: flex;
|
|
479
432
|
flex-direction: column;
|
|
@@ -3,6 +3,7 @@
|
|
|
3
3
|
class="dd-goods-card"
|
|
4
4
|
:class="[
|
|
5
5
|
`dd-goods-card--${layout}`,
|
|
6
|
+
`dd-goods-card--${size}`,
|
|
6
7
|
{ 'dd-goods-card--disabled': disabled },
|
|
7
8
|
]"
|
|
8
9
|
:style="customStyle"
|
|
@@ -37,6 +38,7 @@
|
|
|
37
38
|
:rate="price"
|
|
38
39
|
:currency="currency"
|
|
39
40
|
:decimal-length="decimalLength"
|
|
41
|
+
:size="size"
|
|
40
42
|
></dd-price>
|
|
41
43
|
<text v-if="originPrice" class="dd-goods-card__price-origin">
|
|
42
44
|
{{ currency }}{{ originPrice }}
|
|
@@ -84,6 +86,8 @@ interface Props {
|
|
|
84
86
|
tag?: string
|
|
85
87
|
/** 布局:horizontal 横向(左图右文)/ vertical 竖向(上图下文) */
|
|
86
88
|
layout?: 'horizontal' | 'vertical'
|
|
89
|
+
/** 尺寸:md 常规 / sm 小号(横向用于购物车列表行且不渲染描述,竖向用于一行三列宫格) */
|
|
90
|
+
size?: 'sm' | 'md'
|
|
87
91
|
/** 已选数量(右下角,不传不渲染) */
|
|
88
92
|
num?: string | number
|
|
89
93
|
/** 置灰(售罄等不可点场景) */
|
|
@@ -106,6 +110,7 @@ const props = withDefaults(defineProps<Props>(), {
|
|
|
106
110
|
decimalLength: 2,
|
|
107
111
|
tag: '',
|
|
108
112
|
layout: 'horizontal',
|
|
113
|
+
size: 'md',
|
|
109
114
|
num: '',
|
|
110
115
|
disabled: false,
|
|
111
116
|
thumbMode: 'aspectFill',
|
|
@@ -290,4 +295,49 @@ function onClick(e: Event) {
|
|
|
290
295
|
padding: $dd-space-3;
|
|
291
296
|
}
|
|
292
297
|
}
|
|
298
|
+
|
|
299
|
+
// 小号卡:划线价随小号档缩小(价格字号由 dd-price size 联动)
|
|
300
|
+
.dd-goods-card--sm {
|
|
301
|
+
.dd-goods-card__price-origin {
|
|
302
|
+
font-size: 20rpx;
|
|
303
|
+
}
|
|
304
|
+
}
|
|
305
|
+
|
|
306
|
+
// 小号横向(购物车列表行):96rpx 紧凑图 + 小字号,不渲染描述
|
|
307
|
+
.dd-goods-card--horizontal.dd-goods-card--sm {
|
|
308
|
+
padding: $dd-space-2;
|
|
309
|
+
|
|
310
|
+
.dd-goods-card__thumb {
|
|
311
|
+
width: 96rpx;
|
|
312
|
+
height: 96rpx;
|
|
313
|
+
}
|
|
314
|
+
|
|
315
|
+
.dd-goods-card__body {
|
|
316
|
+
padding-left: $dd-space-2;
|
|
317
|
+
}
|
|
318
|
+
|
|
319
|
+
.dd-goods-card__title {
|
|
320
|
+
font-size: 26rpx;
|
|
321
|
+
}
|
|
322
|
+
|
|
323
|
+
.dd-goods-card__num {
|
|
324
|
+
font-size: 22rpx;
|
|
325
|
+
}
|
|
326
|
+
}
|
|
327
|
+
|
|
328
|
+
// 小号竖向(一行三列宫格):方图 + 标题最多两行(对齐点选套餐页三列规格卡)
|
|
329
|
+
.dd-goods-card--vertical.dd-goods-card--sm {
|
|
330
|
+
.dd-goods-card__body {
|
|
331
|
+
padding: $dd-space-2;
|
|
332
|
+
}
|
|
333
|
+
|
|
334
|
+
.dd-goods-card__title {
|
|
335
|
+
font-size: 24rpx;
|
|
336
|
+
@include dd-ellipsis(2);
|
|
337
|
+
}
|
|
338
|
+
|
|
339
|
+
.dd-goods-card__desc {
|
|
340
|
+
font-size: 20rpx;
|
|
341
|
+
}
|
|
342
|
+
}
|
|
293
343
|
</style>
|
|
@@ -65,6 +65,8 @@
|
|
|
65
65
|
</view>
|
|
66
66
|
</view>
|
|
67
67
|
</dd-popup>
|
|
68
|
+
<!-- 库内 toast(toast 档 2040,恒高于自身 popup 面板);单例状态,页面另有 dd-toast 时自动共用 -->
|
|
69
|
+
<dd-toast />
|
|
68
70
|
</view>
|
|
69
71
|
</template>
|
|
70
72
|
|
|
@@ -78,6 +80,7 @@
|
|
|
78
80
|
import { computed, reactive, ref } from 'vue'
|
|
79
81
|
import DdPopup from '../dd-popup/dd-popup.vue'
|
|
80
82
|
import DdButton from '../dd-button/dd-button.vue'
|
|
83
|
+
import DdToast, { showToast } from '../dd-toast/dd-toast.vue'
|
|
81
84
|
import { pickAvatarHue, avatarText as calcAvatarText } from '../../libs/utils'
|
|
82
85
|
import {
|
|
83
86
|
type PackageSkuGroup,
|
|
@@ -180,7 +183,7 @@ function onItemClick(group: PackageSkuGroup, item: PackageSkuItem): void {
|
|
|
180
183
|
const key = String(group.id)
|
|
181
184
|
const next = nextSelection(group, selections[key] ?? [], item.id)
|
|
182
185
|
if (next === null) {
|
|
183
|
-
|
|
186
|
+
showToast({ message: `最多选择${groupMax(group)}项`, type: 'text' })
|
|
184
187
|
return
|
|
185
188
|
}
|
|
186
189
|
selections[key] = next
|
|
@@ -1,5 +1,5 @@
|
|
|
1
1
|
<template>
|
|
2
|
-
<view v-if="pricePair" class="dd-price">
|
|
2
|
+
<view v-if="pricePair" class="dd-price" :class="'dd-price--' + size">
|
|
3
3
|
<text v-if="prefix" class="dd-price__prefix">{{ prefix }}</text>
|
|
4
4
|
<text class="dd-price__currency">{{ currency }}</text>
|
|
5
5
|
<text class="dd-price__integer">{{ pricePair[0] }}</text>
|
|
@@ -24,6 +24,8 @@ interface Props {
|
|
|
24
24
|
prefix?: string
|
|
25
25
|
/** 额外后缀文案(如「起」) */
|
|
26
26
|
suffix?: string
|
|
27
|
+
/** 尺寸:sm 小号(购物车行/小卡)/ md 常规 / lg 大号(结算条/合计) */
|
|
28
|
+
size?: 'sm' | 'md' | 'lg'
|
|
27
29
|
}
|
|
28
30
|
|
|
29
31
|
const props = withDefaults(defineProps<Props>(), {
|
|
@@ -33,6 +35,7 @@ const props = withDefaults(defineProps<Props>(), {
|
|
|
33
35
|
mark: '.',
|
|
34
36
|
prefix: '',
|
|
35
37
|
suffix: '',
|
|
38
|
+
size: 'md',
|
|
36
39
|
})
|
|
37
40
|
|
|
38
41
|
const pricePair = computed<string[] | null>(() => {
|
|
@@ -80,5 +83,33 @@ const pricePair = computed<string[] | null>(() => {
|
|
|
80
83
|
&__integer {
|
|
81
84
|
font-size: 36rpx;
|
|
82
85
|
}
|
|
86
|
+
|
|
87
|
+
// sm:购物车列表行 / 小号商品卡
|
|
88
|
+
&--sm {
|
|
89
|
+
.dd-price__prefix,
|
|
90
|
+
.dd-price__suffix,
|
|
91
|
+
.dd-price__currency,
|
|
92
|
+
.dd-price__decimal {
|
|
93
|
+
font-size: 20rpx;
|
|
94
|
+
}
|
|
95
|
+
|
|
96
|
+
.dd-price__integer {
|
|
97
|
+
font-size: 30rpx;
|
|
98
|
+
}
|
|
99
|
+
}
|
|
100
|
+
|
|
101
|
+
// lg:结算条 / 合计
|
|
102
|
+
&--lg {
|
|
103
|
+
.dd-price__prefix,
|
|
104
|
+
.dd-price__suffix,
|
|
105
|
+
.dd-price__currency,
|
|
106
|
+
.dd-price__decimal {
|
|
107
|
+
font-size: 28rpx;
|
|
108
|
+
}
|
|
109
|
+
|
|
110
|
+
.dd-price__integer {
|
|
111
|
+
font-size: 44rpx;
|
|
112
|
+
}
|
|
113
|
+
}
|
|
83
114
|
}
|
|
84
115
|
</style>
|
package/libs/config/zIndex.js
CHANGED
|
@@ -1,6 +1,8 @@
|
|
|
1
1
|
// z-index 唯一真源档位表(ADR 0013):组件只准选档或档内 +1 派生,禁止魔数。
|
|
2
2
|
// uniapp 在 H5 中各 API 的 z-index 平台事实(页面层必须低于它们):
|
|
3
3
|
// actionsheet: 999 / modal: 999 / toast: 999 / navigate: 998 / tabbar: 998
|
|
4
|
+
// → 提示类(modal/toast/actionsheet)经 scss/theme.scss 的 H5 补丁统一抬到 2050
|
|
5
|
+
// (高于本表全部档位),否则会压在库内弹层 overlay 2000+ 之下(如购物车面板开启时 confirm 被盖)。
|
|
4
6
|
|
|
5
7
|
export default {
|
|
6
8
|
base: 1, // 普通层内叠放
|
package/package.json
CHANGED
package/scss/theme.scss
CHANGED
|
@@ -12,12 +12,93 @@
|
|
|
12
12
|
// ============================================================
|
|
13
13
|
@import './variables';
|
|
14
14
|
@import './theme-tokens';
|
|
15
|
+
@import './mixins';
|
|
15
16
|
|
|
16
17
|
/* #ifdef H5 */
|
|
17
18
|
:root {
|
|
18
19
|
@include dd-theme($dd-vars-base);
|
|
19
20
|
@include dd-theme($dd-theme-dark);
|
|
20
21
|
}
|
|
22
|
+
|
|
23
|
+
// 平台提示类弹层补丁:uni 的 showModal/showToast/showActionSheet 在 H5 固定 z-index 999,
|
|
24
|
+
// 会被库内弹层(overlay 2000+,如购物车面板)压住;统一抬到 2050(高于本库最高档 toast 2040),
|
|
25
|
+
// 确保所有提示类弹框恒在最顶层。档位表见 libs/config/zIndex.js。
|
|
26
|
+
uni-modal,
|
|
27
|
+
uni-toast,
|
|
28
|
+
uni-actionsheet {
|
|
29
|
+
z-index: 2050 !important;
|
|
30
|
+
}
|
|
31
|
+
|
|
32
|
+
// 平台弹层主题对齐:uni H5 的 showModal/showToast/showActionSheet 写死白底蓝按钮,
|
|
33
|
+
// 按选择器(取自 @dcloudio/uni-h5/style/api/*.css)覆写为库内 token,明暗主题跟随换肤。
|
|
34
|
+
// 选择器带元素前缀提高特异性,免 !important(z-index 除外,见上)。
|
|
35
|
+
uni-modal {
|
|
36
|
+
.uni-modal {
|
|
37
|
+
background-color: var(--dd-bg-elevated, #{$dd-bg-elevated});
|
|
38
|
+
}
|
|
39
|
+
|
|
40
|
+
.uni-modal__title {
|
|
41
|
+
color: var(--dd-text-primary, #{$dd-text-primary});
|
|
42
|
+
}
|
|
43
|
+
|
|
44
|
+
.uni-modal__bd {
|
|
45
|
+
color: var(--dd-text-secondary, #{$dd-text-secondary});
|
|
46
|
+
}
|
|
47
|
+
|
|
48
|
+
.uni-modal__ft:after,
|
|
49
|
+
.uni-modal__btn:after {
|
|
50
|
+
border-color: var(--dd-border-default, #{$dd-border-default});
|
|
51
|
+
}
|
|
52
|
+
|
|
53
|
+
// ponytail: uni-h5 给按钮写内联 color(confirmColor 机制),只能 !important 压掉;
|
|
54
|
+
// 代价是 uni.showModal({ confirmColor }) 自定义色会被忽略(需要自定义色时用库内 dd-dialog)
|
|
55
|
+
.uni-modal__btn,
|
|
56
|
+
.uni-modal__btn_default {
|
|
57
|
+
color: var(--dd-text-primary, #{$dd-text-primary}) !important;
|
|
58
|
+
}
|
|
59
|
+
|
|
60
|
+
.uni-modal__btn_primary {
|
|
61
|
+
color: var(--dd-primary, #{$dd-primary}) !important;
|
|
62
|
+
}
|
|
63
|
+
|
|
64
|
+
.uni-modal__btn:active {
|
|
65
|
+
background-color: var(--dd-border-strong, #{$dd-border-strong});
|
|
66
|
+
}
|
|
67
|
+
}
|
|
68
|
+
|
|
69
|
+
// 平台 toast 对齐库内 dd-toast 的玻璃胶囊风格
|
|
70
|
+
uni-toast {
|
|
71
|
+
.uni-toast,
|
|
72
|
+
.uni-simple-toast__text {
|
|
73
|
+
@include dd-glass;
|
|
74
|
+
border-radius: $dd-radius-full;
|
|
75
|
+
}
|
|
76
|
+
}
|
|
77
|
+
|
|
78
|
+
uni-actionsheet {
|
|
79
|
+
.uni-actionsheet__menu,
|
|
80
|
+
.uni-actionsheet__action {
|
|
81
|
+
background-color: var(--dd-bg-elevated, #{$dd-bg-elevated});
|
|
82
|
+
}
|
|
83
|
+
|
|
84
|
+
.uni-actionsheet__title {
|
|
85
|
+
color: var(--dd-text-primary, #{$dd-text-primary});
|
|
86
|
+
background-color: var(--dd-bg-elevated, #{$dd-bg-elevated});
|
|
87
|
+
border-bottom: 1px solid var(--dd-border-default, #{$dd-border-default});
|
|
88
|
+
}
|
|
89
|
+
|
|
90
|
+
.uni-actionsheet__cell {
|
|
91
|
+
color: var(--dd-text-primary, #{$dd-text-primary});
|
|
92
|
+
}
|
|
93
|
+
|
|
94
|
+
.uni-actionsheet__cell:before {
|
|
95
|
+
border-top-color: var(--dd-border-subtle, #{$dd-border-subtle});
|
|
96
|
+
}
|
|
97
|
+
|
|
98
|
+
.uni-actionsheet__cell:active {
|
|
99
|
+
background-color: var(--dd-border-strong, #{$dd-border-strong});
|
|
100
|
+
}
|
|
101
|
+
}
|
|
21
102
|
/* #endif */
|
|
22
103
|
|
|
23
104
|
/* #ifndef H5 */
|