uniapp-dyckui 4.1.5 → 4.1.7
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 +7 -80
- package/dist/assets/style.css +364 -276
- package/dist/index.cjs +118 -29
- package/dist/index.cjs.map +1 -1
- package/dist/index.mjs +118 -29
- package/dist/index.mjs.map +1 -1
- package/dist/src/components/MyComs/Dialog/index.vue.d.ts +19 -2
- package/dist/src/components/MyComs/Toast/index.vue.d.ts +38 -3
- package/dist/src/components/MyComs/index.d.ts +196 -44
- package/package.json +225 -215
- package/src/components/MyComs/Dialog/README.md +217 -159
- package/src/components/MyComs/Dialog/index.vue +335 -275
- package/src/components/MyComs/Popup/index.vue +0 -2
- package/src/components/MyComs/Toast/README.md +47 -0
- package/src/components/MyComs/Toast/index.vue +189 -34
|
@@ -1,275 +1,335 @@
|
|
|
1
|
-
<template>
|
|
2
|
-
<view v-if="showDialog" class="dialog-wrapper" @click="handleMaskClick">
|
|
3
|
-
<view class="dialog-container" @click.stop>
|
|
4
|
-
<!-- 上部分内容 -->
|
|
5
|
-
<view class="dialog-content">
|
|
6
|
-
<view class="dialog-icon">
|
|
7
|
-
|
|
8
|
-
|
|
9
|
-
|
|
10
|
-
|
|
11
|
-
|
|
12
|
-
|
|
13
|
-
|
|
14
|
-
|
|
15
|
-
|
|
16
|
-
|
|
17
|
-
|
|
18
|
-
|
|
19
|
-
|
|
20
|
-
|
|
21
|
-
|
|
22
|
-
|
|
23
|
-
|
|
24
|
-
|
|
25
|
-
|
|
26
|
-
|
|
27
|
-
|
|
28
|
-
|
|
29
|
-
|
|
30
|
-
|
|
31
|
-
|
|
32
|
-
|
|
33
|
-
|
|
34
|
-
|
|
35
|
-
|
|
36
|
-
|
|
37
|
-
|
|
38
|
-
|
|
39
|
-
|
|
40
|
-
|
|
41
|
-
|
|
42
|
-
|
|
43
|
-
|
|
44
|
-
|
|
45
|
-
|
|
46
|
-
|
|
47
|
-
|
|
48
|
-
|
|
49
|
-
|
|
50
|
-
|
|
51
|
-
<
|
|
52
|
-
|
|
53
|
-
|
|
54
|
-
|
|
55
|
-
|
|
56
|
-
|
|
57
|
-
|
|
58
|
-
|
|
59
|
-
|
|
60
|
-
|
|
61
|
-
|
|
62
|
-
|
|
63
|
-
|
|
64
|
-
|
|
65
|
-
|
|
66
|
-
|
|
67
|
-
|
|
68
|
-
|
|
69
|
-
|
|
70
|
-
|
|
71
|
-
|
|
72
|
-
|
|
73
|
-
|
|
74
|
-
|
|
75
|
-
|
|
76
|
-
|
|
77
|
-
|
|
78
|
-
|
|
79
|
-
|
|
80
|
-
|
|
81
|
-
|
|
82
|
-
|
|
83
|
-
|
|
84
|
-
|
|
85
|
-
|
|
86
|
-
|
|
87
|
-
|
|
88
|
-
|
|
89
|
-
|
|
90
|
-
|
|
91
|
-
|
|
92
|
-
|
|
93
|
-
|
|
94
|
-
|
|
95
|
-
|
|
96
|
-
|
|
97
|
-
|
|
98
|
-
|
|
99
|
-
|
|
100
|
-
|
|
101
|
-
|
|
102
|
-
|
|
103
|
-
|
|
104
|
-
|
|
105
|
-
|
|
106
|
-
|
|
107
|
-
|
|
108
|
-
|
|
109
|
-
|
|
110
|
-
|
|
111
|
-
|
|
112
|
-
|
|
113
|
-
|
|
114
|
-
|
|
115
|
-
|
|
116
|
-
|
|
117
|
-
|
|
118
|
-
|
|
119
|
-
|
|
120
|
-
showDialog.value =
|
|
121
|
-
}
|
|
122
|
-
|
|
123
|
-
//
|
|
124
|
-
|
|
125
|
-
emit('
|
|
126
|
-
|
|
127
|
-
|
|
128
|
-
|
|
129
|
-
|
|
130
|
-
|
|
131
|
-
|
|
132
|
-
|
|
133
|
-
|
|
134
|
-
|
|
135
|
-
|
|
136
|
-
|
|
137
|
-
|
|
138
|
-
|
|
139
|
-
|
|
140
|
-
|
|
141
|
-
|
|
142
|
-
|
|
143
|
-
|
|
144
|
-
|
|
145
|
-
|
|
146
|
-
|
|
147
|
-
|
|
148
|
-
|
|
149
|
-
|
|
150
|
-
|
|
151
|
-
|
|
152
|
-
|
|
153
|
-
|
|
154
|
-
|
|
155
|
-
|
|
156
|
-
|
|
157
|
-
|
|
158
|
-
|
|
159
|
-
|
|
160
|
-
|
|
161
|
-
|
|
162
|
-
|
|
163
|
-
|
|
164
|
-
|
|
165
|
-
|
|
166
|
-
|
|
167
|
-
|
|
168
|
-
|
|
169
|
-
|
|
170
|
-
|
|
171
|
-
|
|
172
|
-
|
|
173
|
-
|
|
174
|
-
|
|
175
|
-
|
|
176
|
-
|
|
177
|
-
|
|
178
|
-
|
|
179
|
-
|
|
180
|
-
|
|
181
|
-
.
|
|
182
|
-
|
|
183
|
-
|
|
184
|
-
|
|
185
|
-
|
|
186
|
-
|
|
187
|
-
|
|
188
|
-
|
|
189
|
-
|
|
190
|
-
|
|
191
|
-
|
|
192
|
-
|
|
193
|
-
|
|
194
|
-
|
|
195
|
-
|
|
196
|
-
|
|
197
|
-
|
|
198
|
-
|
|
199
|
-
|
|
200
|
-
|
|
201
|
-
|
|
202
|
-
|
|
203
|
-
|
|
204
|
-
|
|
205
|
-
|
|
206
|
-
|
|
207
|
-
|
|
208
|
-
|
|
209
|
-
}
|
|
210
|
-
|
|
211
|
-
/*
|
|
212
|
-
.dialog-
|
|
213
|
-
|
|
214
|
-
|
|
215
|
-
|
|
216
|
-
|
|
217
|
-
|
|
218
|
-
|
|
219
|
-
|
|
220
|
-
|
|
221
|
-
|
|
222
|
-
|
|
223
|
-
|
|
224
|
-
|
|
225
|
-
|
|
226
|
-
|
|
227
|
-
|
|
228
|
-
|
|
229
|
-
|
|
230
|
-
|
|
231
|
-
|
|
232
|
-
|
|
233
|
-
|
|
234
|
-
|
|
235
|
-
|
|
236
|
-
|
|
237
|
-
|
|
238
|
-
|
|
239
|
-
|
|
240
|
-
|
|
241
|
-
|
|
242
|
-
|
|
243
|
-
|
|
244
|
-
|
|
245
|
-
|
|
246
|
-
|
|
247
|
-
|
|
248
|
-
|
|
249
|
-
|
|
250
|
-
|
|
251
|
-
|
|
252
|
-
|
|
253
|
-
|
|
254
|
-
|
|
255
|
-
|
|
256
|
-
|
|
257
|
-
|
|
258
|
-
|
|
259
|
-
|
|
260
|
-
|
|
261
|
-
|
|
262
|
-
|
|
263
|
-
|
|
264
|
-
|
|
265
|
-
|
|
266
|
-
|
|
267
|
-
|
|
268
|
-
|
|
269
|
-
|
|
270
|
-
|
|
271
|
-
|
|
272
|
-
|
|
273
|
-
|
|
274
|
-
|
|
275
|
-
|
|
1
|
+
<template>
|
|
2
|
+
<view v-if="showDialog" class="dialog-wrapper" @click="handleMaskClick">
|
|
3
|
+
<view class="dialog-container" @click.stop>
|
|
4
|
+
<!-- 上部分内容 -->
|
|
5
|
+
<view class="dialog-content">
|
|
6
|
+
<view class="dialog-icon">
|
|
7
|
+
<!-- 图标插槽包装器 -->
|
|
8
|
+
<slot name="icon">
|
|
9
|
+
<!-- 自定义字体图标 -->
|
|
10
|
+
<text v-if="customIcon" class="iconfont dialog-icon-custom">{{ customIcon }}</text>
|
|
11
|
+
<!-- 根据图标类型显示字体图标 -->
|
|
12
|
+
<text v-else-if="iconType === 'phone'" class="iconfont dialog-button-primary icon-shouji" />
|
|
13
|
+
<text v-else-if="iconType === 'screen'" class="iconfont dialog-button-primary icon-xianshiqi" />
|
|
14
|
+
<text v-else-if="iconType === 'links'" class="iconfont dialog-button-primary icon-xianshiqi1" />
|
|
15
|
+
<text v-else-if="iconType === 'links2'" class="iconfont dialog-button-primary icon-lianjiewangzhi" />
|
|
16
|
+
<!-- 兼容旧版本的图片图标 -->
|
|
17
|
+
<image v-else-if="icon" :src="icon" alt="dialog-icon" />
|
|
18
|
+
<!-- 默认图标 -->
|
|
19
|
+
<view v-else class="default-icon" />
|
|
20
|
+
</slot>
|
|
21
|
+
</view>
|
|
22
|
+
<view class="dialog-title">
|
|
23
|
+
{{ title }}
|
|
24
|
+
</view>
|
|
25
|
+
<text class="dialog-description">{{ description }}</text>
|
|
26
|
+
</view>
|
|
27
|
+
|
|
28
|
+
<!-- 分割线 -->
|
|
29
|
+
<view class="dialog-divider" />
|
|
30
|
+
|
|
31
|
+
<!-- 下部分按钮 -->
|
|
32
|
+
<view class="dialog-buttons">
|
|
33
|
+
<!-- 类型1: 取消和打开app -->
|
|
34
|
+
<template v-if="type === 'open-app'">
|
|
35
|
+
<view class="dialog-button dialog-button-cancel" @click="handleCancel">
|
|
36
|
+
取消
|
|
37
|
+
</view>
|
|
38
|
+
<view class="dialog-button dialog-button-primary" @click="handleConfirm">
|
|
39
|
+
打开app
|
|
40
|
+
</view>
|
|
41
|
+
</template>
|
|
42
|
+
|
|
43
|
+
<!-- 类型2: 知道了 -->
|
|
44
|
+
<template v-else-if="type === 'confirm'">
|
|
45
|
+
<view class="dialog-button dialog-button-full dialog-button-primary" @click="handleConfirm">
|
|
46
|
+
知道了
|
|
47
|
+
</view>
|
|
48
|
+
</template>
|
|
49
|
+
|
|
50
|
+
<!-- 类型3: 取消和继续访问 -->
|
|
51
|
+
<template v-else-if="type === 'continue'">
|
|
52
|
+
<view class="dialog-button dialog-button-cancel" @click="handleCancel">
|
|
53
|
+
取消
|
|
54
|
+
</view>
|
|
55
|
+
<view class="dialog-button dialog-button-primary" @click="handleConfirm">
|
|
56
|
+
继续访问
|
|
57
|
+
</view>
|
|
58
|
+
</template>
|
|
59
|
+
</view>
|
|
60
|
+
</view>
|
|
61
|
+
</view>
|
|
62
|
+
</template>
|
|
63
|
+
|
|
64
|
+
<script setup lang="ts">
|
|
65
|
+
import { ref, watch } from 'vue'
|
|
66
|
+
|
|
67
|
+
// 弹窗类型定义
|
|
68
|
+
type DialogType = 'open-app' | 'confirm' | 'continue'
|
|
69
|
+
|
|
70
|
+
// Props定义
|
|
71
|
+
interface Props {
|
|
72
|
+
// 控制弹窗显示/隐藏(支持v-model)
|
|
73
|
+
modelValue?: boolean
|
|
74
|
+
// 弹窗类型
|
|
75
|
+
type?: DialogType
|
|
76
|
+
// 弹窗标题
|
|
77
|
+
title?: string
|
|
78
|
+
// 弹窗说明文字
|
|
79
|
+
description?: string
|
|
80
|
+
// 图标路径(兼容旧版本)
|
|
81
|
+
icon?: string
|
|
82
|
+
// 图标类型:phone、screen、links、links2
|
|
83
|
+
iconType?: 'phone' | 'screen' | 'links' | 'links2'
|
|
84
|
+
// 自定义字体图标
|
|
85
|
+
customIcon?: string
|
|
86
|
+
// 是否显示遮罩层
|
|
87
|
+
mask?: boolean
|
|
88
|
+
// 遮罩层透明度
|
|
89
|
+
maskOpacity?: number
|
|
90
|
+
// 点击遮罩是否关闭弹窗
|
|
91
|
+
closeOnMaskClick?: boolean
|
|
92
|
+
}
|
|
93
|
+
|
|
94
|
+
// Props默认值
|
|
95
|
+
const props = withDefaults(defineProps<Props>(), {
|
|
96
|
+
modelValue: false,
|
|
97
|
+
type: 'confirm',
|
|
98
|
+
title: '',
|
|
99
|
+
description: '',
|
|
100
|
+
icon: '',
|
|
101
|
+
iconType: undefined,
|
|
102
|
+
customIcon: '',
|
|
103
|
+
mask: true,
|
|
104
|
+
maskOpacity: 0.5,
|
|
105
|
+
closeOnMaskClick: true,
|
|
106
|
+
})
|
|
107
|
+
|
|
108
|
+
// Emits定义
|
|
109
|
+
const emit = defineEmits<{
|
|
110
|
+
(e: 'update:modelValue', value: boolean): void
|
|
111
|
+
(e: 'confirm'): void
|
|
112
|
+
(e: 'cancel'): void
|
|
113
|
+
}>()
|
|
114
|
+
|
|
115
|
+
// 本地状态
|
|
116
|
+
const showDialog = ref(props.modelValue)
|
|
117
|
+
|
|
118
|
+
// 监听modelValue变化
|
|
119
|
+
watch(() => props.modelValue, (newVal) => {
|
|
120
|
+
showDialog.value = newVal
|
|
121
|
+
})
|
|
122
|
+
|
|
123
|
+
// 监听showDialog变化
|
|
124
|
+
watch(() => showDialog.value, (newVal) => {
|
|
125
|
+
emit('update:modelValue', newVal)
|
|
126
|
+
})
|
|
127
|
+
|
|
128
|
+
// 点击遮罩层
|
|
129
|
+
function handleMaskClick() {
|
|
130
|
+
if (props.closeOnMaskClick) {
|
|
131
|
+
showDialog.value = false
|
|
132
|
+
}
|
|
133
|
+
}
|
|
134
|
+
|
|
135
|
+
// 点击确认按钮
|
|
136
|
+
function handleConfirm() {
|
|
137
|
+
emit('confirm')
|
|
138
|
+
// 确认后关闭弹窗
|
|
139
|
+
showDialog.value = false
|
|
140
|
+
}
|
|
141
|
+
|
|
142
|
+
// 点击取消按钮
|
|
143
|
+
function handleCancel() {
|
|
144
|
+
emit('cancel')
|
|
145
|
+
// 取消后关闭弹窗
|
|
146
|
+
showDialog.value = false
|
|
147
|
+
}
|
|
148
|
+
</script>
|
|
149
|
+
|
|
150
|
+
<style scoped>
|
|
151
|
+
/* 弹窗容器 */
|
|
152
|
+
.dialog-wrapper {
|
|
153
|
+
position: fixed;
|
|
154
|
+
top: 0;
|
|
155
|
+
left: 0;
|
|
156
|
+
right: 0;
|
|
157
|
+
bottom: 0;
|
|
158
|
+
z-index: 1000;
|
|
159
|
+
display: flex;
|
|
160
|
+
align-items: center;
|
|
161
|
+
justify-content: center;
|
|
162
|
+
background-color: rgba(0, 0, 0, v-bind('maskOpacity'));
|
|
163
|
+
animation: fadeIn 300ms ease;
|
|
164
|
+
}
|
|
165
|
+
|
|
166
|
+
/* 弹窗主体 */
|
|
167
|
+
.dialog-container {
|
|
168
|
+
width: 80%;
|
|
169
|
+
max-width: 800rpx;
|
|
170
|
+
background-color: #fff;
|
|
171
|
+
border-radius: 32rpx;
|
|
172
|
+
overflow: hidden;
|
|
173
|
+
box-shadow: 0 8rpx 40rpx rgba(0, 0, 0, 0.15);
|
|
174
|
+
animation: scaleIn 300ms ease;
|
|
175
|
+
background-image: url('@/assets/u2.png');
|
|
176
|
+
background-size: cover;
|
|
177
|
+
background-position: center;
|
|
178
|
+
}
|
|
179
|
+
|
|
180
|
+
/* 上部分内容 */
|
|
181
|
+
.dialog-content {
|
|
182
|
+
padding: 60rpx 40rpx;
|
|
183
|
+
text-align: center;
|
|
184
|
+
}
|
|
185
|
+
|
|
186
|
+
/* 图标 */
|
|
187
|
+
.dialog-icon {
|
|
188
|
+
margin-bottom: 40rpx;
|
|
189
|
+
display: flex;
|
|
190
|
+
justify-content: center;
|
|
191
|
+
align-items: center;
|
|
192
|
+
display: inline-block;
|
|
193
|
+
border-radius: 50%;
|
|
194
|
+
border: 2rpx solid rgb(151, 150, 150);
|
|
195
|
+
}
|
|
196
|
+
|
|
197
|
+
/* 确保dialog-icon容器内的所有直接子元素都应用相同的基础样式 */
|
|
198
|
+
.dialog-icon > * {
|
|
199
|
+
width: 120rpx;
|
|
200
|
+
height: 120rpx;
|
|
201
|
+
font-size: 80rpx;
|
|
202
|
+
display: flex;
|
|
203
|
+
justify-content: center;
|
|
204
|
+
align-items: center;
|
|
205
|
+
}
|
|
206
|
+
|
|
207
|
+
.dialog-icon image {
|
|
208
|
+
object-fit: contain;
|
|
209
|
+
}
|
|
210
|
+
|
|
211
|
+
/* 字体图标样式 */
|
|
212
|
+
.dialog-icon .iconfont {
|
|
213
|
+
/* 已通过 .dialog-icon > * 应用基础样式 */
|
|
214
|
+
}
|
|
215
|
+
|
|
216
|
+
/* 自定义字体图标 */
|
|
217
|
+
.dialog-icon-custom {
|
|
218
|
+
color: #1989fa;
|
|
219
|
+
}
|
|
220
|
+
|
|
221
|
+
/* 成功图标 */
|
|
222
|
+
.dialog-icon-success {
|
|
223
|
+
color: #67c23a;
|
|
224
|
+
}
|
|
225
|
+
|
|
226
|
+
/* 警告图标 */
|
|
227
|
+
.dialog-icon-warning {
|
|
228
|
+
color: #e6a23c;
|
|
229
|
+
}
|
|
230
|
+
|
|
231
|
+
/* 错误图标 */
|
|
232
|
+
.dialog-icon-error {
|
|
233
|
+
color: #f56c6c;
|
|
234
|
+
}
|
|
235
|
+
|
|
236
|
+
/* 信息图标 */
|
|
237
|
+
.dialog-icon-info {
|
|
238
|
+
color: #909399;
|
|
239
|
+
}
|
|
240
|
+
|
|
241
|
+
.default-icon {
|
|
242
|
+
width: 120rpx;
|
|
243
|
+
height: 120rpx;
|
|
244
|
+
background-color: #f0f0f0;
|
|
245
|
+
border-radius: 50%;
|
|
246
|
+
}
|
|
247
|
+
|
|
248
|
+
/* 标题 */
|
|
249
|
+
.dialog-title {
|
|
250
|
+
font-size: 36rpx;
|
|
251
|
+
font-weight: bold;
|
|
252
|
+
color: #333;
|
|
253
|
+
margin: 0 0 20rpx 0;
|
|
254
|
+
}
|
|
255
|
+
|
|
256
|
+
/* 说明文字 */
|
|
257
|
+
.dialog-description {
|
|
258
|
+
font-size: 28rpx;
|
|
259
|
+
color: #666;
|
|
260
|
+
margin: 0;
|
|
261
|
+
line-height: 1.5;
|
|
262
|
+
}
|
|
263
|
+
|
|
264
|
+
/* 分割线 */
|
|
265
|
+
.dialog-divider {
|
|
266
|
+
height: 2rpx;
|
|
267
|
+
background-color: #e5e5e5;
|
|
268
|
+
margin: 0;
|
|
269
|
+
}
|
|
270
|
+
|
|
271
|
+
/* 按钮区域 */
|
|
272
|
+
.dialog-buttons {
|
|
273
|
+
display: flex;
|
|
274
|
+
flex-direction: row;
|
|
275
|
+
align-items: center;
|
|
276
|
+
}
|
|
277
|
+
|
|
278
|
+
/* 按钮 */
|
|
279
|
+
.dialog-button {
|
|
280
|
+
flex: 1;
|
|
281
|
+
padding: 30rpx;
|
|
282
|
+
border: none;
|
|
283
|
+
background: none;
|
|
284
|
+
font-size: 32rpx;
|
|
285
|
+
font-weight: 500;
|
|
286
|
+
cursor: pointer;
|
|
287
|
+
transition: background-color 0.3s ease;
|
|
288
|
+
text-align: center;
|
|
289
|
+
box-sizing: border-box;
|
|
290
|
+
}
|
|
291
|
+
|
|
292
|
+
/* 全宽按钮 */
|
|
293
|
+
.dialog-button-full {
|
|
294
|
+
width: 100%;
|
|
295
|
+
}
|
|
296
|
+
|
|
297
|
+
/* 取消按钮 */
|
|
298
|
+
.dialog-button-cancel {
|
|
299
|
+
color: #666;
|
|
300
|
+
}
|
|
301
|
+
|
|
302
|
+
.dialog-button-cancel:hover {
|
|
303
|
+
background-color: #f5f5f5;
|
|
304
|
+
}
|
|
305
|
+
|
|
306
|
+
/* 主要按钮 */
|
|
307
|
+
.dialog-button-primary {
|
|
308
|
+
color: #00599c;
|
|
309
|
+
}
|
|
310
|
+
|
|
311
|
+
.dialog-button-primary:hover {
|
|
312
|
+
background-color: #f0f9ff;
|
|
313
|
+
}
|
|
314
|
+
|
|
315
|
+
/* 动画效果 */
|
|
316
|
+
@keyframes fadeIn {
|
|
317
|
+
from {
|
|
318
|
+
opacity: 0;
|
|
319
|
+
}
|
|
320
|
+
to {
|
|
321
|
+
opacity: 1;
|
|
322
|
+
}
|
|
323
|
+
}
|
|
324
|
+
|
|
325
|
+
@keyframes scaleIn {
|
|
326
|
+
from {
|
|
327
|
+
transform: scale(0.8);
|
|
328
|
+
opacity: 0;
|
|
329
|
+
}
|
|
330
|
+
to {
|
|
331
|
+
transform: scale(1);
|
|
332
|
+
opacity: 1;
|
|
333
|
+
}
|
|
334
|
+
}
|
|
335
|
+
</style>
|
|
@@ -226,7 +226,6 @@ function lockScroll() {
|
|
|
226
226
|
// #endif
|
|
227
227
|
|
|
228
228
|
// #ifdef MP
|
|
229
|
-
// @ts-expect-error 小程序特有API,TypeScript类型定义缺失
|
|
230
229
|
uni.hideTabBar()
|
|
231
230
|
// #endif
|
|
232
231
|
}
|
|
@@ -243,7 +242,6 @@ function unlockScroll() {
|
|
|
243
242
|
// #endif
|
|
244
243
|
|
|
245
244
|
// #ifdef MP
|
|
246
|
-
// @ts-expect-error 小程序特有API,TypeScript类型定义缺失
|
|
247
245
|
uni.showTabBar()
|
|
248
246
|
// #endif
|
|
249
247
|
}
|