uniapp-dyckui 4.1.1
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/LICENSE +21 -0
- package/README.md +104 -0
- package/dist/assets/style.BFlsbpSj.css +1472 -0
- package/dist/index.cjs.js +1380 -0
- package/dist/index.cjs.js.map +1 -0
- package/dist/index.es.js +1380 -0
- package/dist/index.es.js.map +1 -0
- package/dist/src/components/MyComs/Button/index.d.ts +3 -0
- package/dist/src/components/MyComs/Button/index.vue.d.ts +93 -0
- package/dist/src/components/MyComs/Dialog/index.d.ts +3 -0
- package/dist/src/components/MyComs/Dialog/index.vue.d.ts +65 -0
- package/dist/src/components/MyComs/Divider/index.d.ts +3 -0
- package/dist/src/components/MyComs/Divider/index.vue.d.ts +53 -0
- package/dist/src/components/MyComs/DropdownSelect/dropdownSelect.d.ts +10 -0
- package/dist/src/components/MyComs/DropdownSelect/index.d.ts +4 -0
- package/dist/src/components/MyComs/DropdownSelect/index.vue.d.ts +26 -0
- package/dist/src/components/MyComs/DropdownSelect/type.d.ts +13 -0
- package/dist/src/components/MyComs/DropdownWithBadge/dropdownWithBadge.d.ts +5 -0
- package/dist/src/components/MyComs/DropdownWithBadge/index.d.ts +4 -0
- package/dist/src/components/MyComs/DropdownWithBadge/index.vue.d.ts +26 -0
- package/dist/src/components/MyComs/DropdownWithBadge/type.d.ts +9 -0
- package/dist/src/components/MyComs/FilterDrawer/hasBadge.d.ts +8 -0
- package/dist/src/components/MyComs/FilterDrawer/index.d.ts +5 -0
- package/dist/src/components/MyComs/FilterDrawer/index.vue.d.ts +26 -0
- package/dist/src/components/MyComs/FilterDrawer/type.d.ts +8 -0
- package/dist/src/components/MyComs/FilterDrawer/useFilterDrawer.d.ts +10 -0
- package/dist/src/components/MyComs/InfiniteScroll/index.d.ts +3 -0
- package/dist/src/components/MyComs/InfiniteScroll/index.vue.d.ts +65 -0
- package/dist/src/components/MyComs/Popup/index.d.ts +3 -0
- package/dist/src/components/MyComs/Popup/index.vue.d.ts +119 -0
- package/dist/src/components/MyComs/PullRefresh/index.d.ts +3 -0
- package/dist/src/components/MyComs/PullRefresh/index.vue.d.ts +117 -0
- package/dist/src/components/MyComs/Swiper/index.d.ts +3 -0
- package/dist/src/components/MyComs/Swiper/index.vue.d.ts +79 -0
- package/dist/src/components/MyComs/Toast/index.d.ts +3 -0
- package/dist/src/components/MyComs/Toast/index.vue.d.ts +108 -0
- package/dist/src/components/MyComs/index.d.ts +20 -0
- package/package.json +218 -0
- package/src/components/MyComs/Button/README.md +235 -0
- package/src/components/MyComs/Button/index.ts +3 -0
- package/src/components/MyComs/Button/index.vue +413 -0
- package/src/components/MyComs/Dialog/README.md +160 -0
- package/src/components/MyComs/Dialog/index.ts +2 -0
- package/src/components/MyComs/Dialog/index.vue +275 -0
- package/src/components/MyComs/Divider/README.md +0 -0
- package/src/components/MyComs/Divider/index.ts +2 -0
- package/src/components/MyComs/Divider/index.vue +106 -0
- package/src/components/MyComs/DropdownSelect/README.md +112 -0
- package/src/components/MyComs/DropdownSelect/dropdownSelect.less +75 -0
- package/src/components/MyComs/DropdownSelect/dropdownSelect.ts +59 -0
- package/src/components/MyComs/DropdownSelect/index.ts +4 -0
- package/src/components/MyComs/DropdownSelect/index.vue +88 -0
- package/src/components/MyComs/DropdownSelect/type.ts +15 -0
- package/src/components/MyComs/DropdownWithBadge/README.md +77 -0
- package/src/components/MyComs/DropdownWithBadge/dropdownWithBadge.less +11 -0
- package/src/components/MyComs/DropdownWithBadge/dropdownWithBadge.ts +10 -0
- package/src/components/MyComs/DropdownWithBadge/index.ts +4 -0
- package/src/components/MyComs/DropdownWithBadge/index.vue +39 -0
- package/src/components/MyComs/DropdownWithBadge/type.ts +12 -0
- package/src/components/MyComs/FilterDrawer/filterDrawer.less +117 -0
- package/src/components/MyComs/FilterDrawer/hasBadge.ts +41 -0
- package/src/components/MyComs/FilterDrawer/index.ts +5 -0
- package/src/components/MyComs/FilterDrawer/index.vue +53 -0
- package/src/components/MyComs/FilterDrawer/type.ts +9 -0
- package/src/components/MyComs/FilterDrawer/useFilterDrawer.ts +38 -0
- package/src/components/MyComs/InfiniteScroll/index.ts +2 -0
- package/src/components/MyComs/InfiniteScroll/index.vue +171 -0
- package/src/components/MyComs/Popup/README.md +684 -0
- package/src/components/MyComs/Popup/index.ts +2 -0
- package/src/components/MyComs/Popup/index.vue +835 -0
- package/src/components/MyComs/PullRefresh/README.md +600 -0
- package/src/components/MyComs/PullRefresh/index.ts +2 -0
- package/src/components/MyComs/PullRefresh/index.vue +599 -0
- package/src/components/MyComs/Swiper/README.md +202 -0
- package/src/components/MyComs/Swiper/index.ts +2 -0
- package/src/components/MyComs/Swiper/index.vue +245 -0
- package/src/components/MyComs/Toast/README.md +604 -0
- package/src/components/MyComs/Toast/index.ts +2 -0
- package/src/components/MyComs/Toast/index.vue +372 -0
- package/src/components/MyComs/index.ts +33 -0
|
@@ -0,0 +1,413 @@
|
|
|
1
|
+
<template>
|
|
2
|
+
<view
|
|
3
|
+
class="sw-button" :class="[
|
|
4
|
+
`sw-button--${type}`,
|
|
5
|
+
`sw-button--${size}`,
|
|
6
|
+
`sw-button--${shape}`,
|
|
7
|
+
{ 'is-disabled': disabled },
|
|
8
|
+
{ 'is-loading': loading },
|
|
9
|
+
{ 'is-block': block },
|
|
10
|
+
{ 'is-round': round },
|
|
11
|
+
{ 'is-plain': plain },
|
|
12
|
+
{ 'is-outline': outline },
|
|
13
|
+
{ 'is-link': link },
|
|
14
|
+
]"
|
|
15
|
+
:disabled="disabled || loading"
|
|
16
|
+
@click="handleClick"
|
|
17
|
+
>
|
|
18
|
+
<!-- 加载动画 -->
|
|
19
|
+
<template v-if="loading">
|
|
20
|
+
<view class="sw-button__loading">
|
|
21
|
+
<text class="loading-spinner" />
|
|
22
|
+
</view>
|
|
23
|
+
</template>
|
|
24
|
+
|
|
25
|
+
<!-- 图标 -->
|
|
26
|
+
<template v-if="!loading">
|
|
27
|
+
<!-- 自定义图标插槽 -->
|
|
28
|
+
<view v-if="$slots.icon" class="sw-button__icon">
|
|
29
|
+
<slot name="icon" />
|
|
30
|
+
</view>
|
|
31
|
+
<!-- 传统图标类名方式 -->
|
|
32
|
+
<text v-if="icon" class="sw-button__icon" :class="[icon]" />
|
|
33
|
+
</template>
|
|
34
|
+
|
|
35
|
+
<!-- 文本内容 -->
|
|
36
|
+
<text v-if="$slots.default" class="sw-button__text">
|
|
37
|
+
<slot />
|
|
38
|
+
</text>
|
|
39
|
+
</view>
|
|
40
|
+
</template>
|
|
41
|
+
|
|
42
|
+
<script setup lang="ts">
|
|
43
|
+
// 按钮类型
|
|
44
|
+
type ButtonType = 'primary' | 'success' | 'warning' | 'danger' | 'info'
|
|
45
|
+
|
|
46
|
+
// 按钮尺寸
|
|
47
|
+
type ButtonSize = 'large' | 'normal' | 'small' | 'mini'
|
|
48
|
+
|
|
49
|
+
// 按钮形状
|
|
50
|
+
type ButtonShape = 'default' | 'circle' | 'round'
|
|
51
|
+
|
|
52
|
+
// 按钮样式
|
|
53
|
+
type ButtonStyle = 'solid' | 'outline' | 'plain' | 'link'
|
|
54
|
+
|
|
55
|
+
interface Props {
|
|
56
|
+
// 按钮类型
|
|
57
|
+
type?: ButtonType
|
|
58
|
+
// 按钮尺寸
|
|
59
|
+
size?: ButtonSize
|
|
60
|
+
// 按钮形状
|
|
61
|
+
shape?: ButtonShape
|
|
62
|
+
// 是否禁用
|
|
63
|
+
disabled?: boolean
|
|
64
|
+
// 是否加载中
|
|
65
|
+
loading?: boolean
|
|
66
|
+
// 是否为块级元素
|
|
67
|
+
block?: boolean
|
|
68
|
+
// 是否为圆形
|
|
69
|
+
round?: boolean
|
|
70
|
+
// 是否为朴素按钮
|
|
71
|
+
plain?: boolean
|
|
72
|
+
// 是否为描边按钮
|
|
73
|
+
outline?: boolean
|
|
74
|
+
// 是否为链接按钮
|
|
75
|
+
link?: boolean
|
|
76
|
+
// 图标类名
|
|
77
|
+
icon?: string
|
|
78
|
+
// 自定义类名
|
|
79
|
+
customClass?: string
|
|
80
|
+
// 自定义样式
|
|
81
|
+
customStyle?: Record<string, any>
|
|
82
|
+
}
|
|
83
|
+
|
|
84
|
+
const props = withDefaults(defineProps<Props>(), {
|
|
85
|
+
type: 'primary',
|
|
86
|
+
size: 'normal',
|
|
87
|
+
shape: 'default',
|
|
88
|
+
disabled: false,
|
|
89
|
+
loading: false,
|
|
90
|
+
block: false,
|
|
91
|
+
round: false,
|
|
92
|
+
plain: false,
|
|
93
|
+
outline: false,
|
|
94
|
+
link: false,
|
|
95
|
+
icon: '',
|
|
96
|
+
customClass: '',
|
|
97
|
+
customStyle: () => ({}),
|
|
98
|
+
})
|
|
99
|
+
|
|
100
|
+
const emit = defineEmits<{
|
|
101
|
+
(e: 'click', event: MouseEvent): void
|
|
102
|
+
}>()
|
|
103
|
+
|
|
104
|
+
function handleClick(event: MouseEvent) {
|
|
105
|
+
if (!props.disabled && !props.loading) {
|
|
106
|
+
emit('click', event)
|
|
107
|
+
}
|
|
108
|
+
}
|
|
109
|
+
</script>
|
|
110
|
+
|
|
111
|
+
<style lang="less" scoped>
|
|
112
|
+
// 主题色变量
|
|
113
|
+
@primary-color: #409eff;
|
|
114
|
+
@success-color: #67c23a;
|
|
115
|
+
@warning-color: #e6a23c;
|
|
116
|
+
@danger-color: #f56c6c;
|
|
117
|
+
@info-color: #909399;
|
|
118
|
+
|
|
119
|
+
// 尺寸变量
|
|
120
|
+
@button-height-large: 88rpx;
|
|
121
|
+
@button-height-normal: 72rpx;
|
|
122
|
+
@button-height-small: 60rpx;
|
|
123
|
+
@button-height-mini: 48rpx;
|
|
124
|
+
|
|
125
|
+
@button-padding-large: 0 48rpx;
|
|
126
|
+
@button-padding-normal: 0 32rpx;
|
|
127
|
+
@button-padding-small: 0 24rpx;
|
|
128
|
+
@button-padding-mini: 0 16rpx;
|
|
129
|
+
|
|
130
|
+
@button-font-size-large: 32rpx;
|
|
131
|
+
@button-font-size-normal: 28rpx;
|
|
132
|
+
@button-font-size-small: 26rpx;
|
|
133
|
+
@button-font-size-mini: 24rpx;
|
|
134
|
+
|
|
135
|
+
// 圆角变量
|
|
136
|
+
@button-border-radius: 8rpx;
|
|
137
|
+
@button-round-border-radius: 40rpx;
|
|
138
|
+
@button-circle-border-radius: 50%;
|
|
139
|
+
|
|
140
|
+
// 基础样式
|
|
141
|
+
.sw-button {
|
|
142
|
+
display: inline-flex;
|
|
143
|
+
align-items: center;
|
|
144
|
+
justify-content: center;
|
|
145
|
+
text-align: center;
|
|
146
|
+
vertical-align: middle;
|
|
147
|
+
cursor: pointer;
|
|
148
|
+
border: none;
|
|
149
|
+
outline: none;
|
|
150
|
+
font-size: @button-font-size-normal;
|
|
151
|
+
font-weight: 400;
|
|
152
|
+
line-height: 1;
|
|
153
|
+
transition: all 0.3s ease;
|
|
154
|
+
box-sizing: border-box;
|
|
155
|
+
position: relative;
|
|
156
|
+
|
|
157
|
+
&:disabled {
|
|
158
|
+
cursor: not-allowed;
|
|
159
|
+
opacity: 0.6;
|
|
160
|
+
}
|
|
161
|
+
|
|
162
|
+
// 文本样式
|
|
163
|
+
.sw-button__text {
|
|
164
|
+
display: inline-block;
|
|
165
|
+
line-height: 1;
|
|
166
|
+
vertical-align: middle;
|
|
167
|
+
}
|
|
168
|
+
|
|
169
|
+
// 图标样式
|
|
170
|
+
.sw-button__icon {
|
|
171
|
+
display: inline-block;
|
|
172
|
+
margin-right: 12rpx;
|
|
173
|
+
font-size: inherit;
|
|
174
|
+
line-height: inherit;
|
|
175
|
+
vertical-align: middle;
|
|
176
|
+
}
|
|
177
|
+
|
|
178
|
+
// 加载动画
|
|
179
|
+
.sw-button__loading {
|
|
180
|
+
display: inline-flex;
|
|
181
|
+
align-items: center;
|
|
182
|
+
margin-right: 12rpx;
|
|
183
|
+
vertical-align: middle;
|
|
184
|
+
|
|
185
|
+
.loading-spinner {
|
|
186
|
+
display: inline-block;
|
|
187
|
+
width: 32rpx;
|
|
188
|
+
height: 32rpx;
|
|
189
|
+
border: 4rpx solid rgba(255, 255, 255, 0.3);
|
|
190
|
+
border-top-color: #fff;
|
|
191
|
+
border-radius: 50%;
|
|
192
|
+
animation: spin 0.8s linear infinite;
|
|
193
|
+
}
|
|
194
|
+
}
|
|
195
|
+
}
|
|
196
|
+
|
|
197
|
+
// 按钮类型
|
|
198
|
+
.sw-button--primary {
|
|
199
|
+
background-color: @primary-color;
|
|
200
|
+
color: #fff;
|
|
201
|
+
}
|
|
202
|
+
|
|
203
|
+
.sw-button--success {
|
|
204
|
+
background-color: @success-color;
|
|
205
|
+
color: #fff;
|
|
206
|
+
}
|
|
207
|
+
|
|
208
|
+
.sw-button--warning {
|
|
209
|
+
background-color: @warning-color;
|
|
210
|
+
color: #fff;
|
|
211
|
+
}
|
|
212
|
+
|
|
213
|
+
.sw-button--danger {
|
|
214
|
+
background-color: @danger-color;
|
|
215
|
+
color: #fff;
|
|
216
|
+
}
|
|
217
|
+
|
|
218
|
+
.sw-button--info {
|
|
219
|
+
background-color: @info-color;
|
|
220
|
+
color: #fff;
|
|
221
|
+
}
|
|
222
|
+
|
|
223
|
+
// 按钮尺寸
|
|
224
|
+
.sw-button--large {
|
|
225
|
+
height: @button-height-large;
|
|
226
|
+
padding: @button-padding-large;
|
|
227
|
+
font-size: @button-font-size-large;
|
|
228
|
+
border-radius: @button-border-radius;
|
|
229
|
+
}
|
|
230
|
+
|
|
231
|
+
.sw-button--normal {
|
|
232
|
+
height: @button-height-normal;
|
|
233
|
+
padding: @button-padding-normal;
|
|
234
|
+
font-size: @button-font-size-normal;
|
|
235
|
+
border-radius: @button-border-radius;
|
|
236
|
+
}
|
|
237
|
+
|
|
238
|
+
.sw-button--small {
|
|
239
|
+
height: @button-height-small;
|
|
240
|
+
padding: @button-padding-small;
|
|
241
|
+
font-size: @button-font-size-small;
|
|
242
|
+
border-radius: @button-border-radius;
|
|
243
|
+
}
|
|
244
|
+
|
|
245
|
+
.sw-button--mini {
|
|
246
|
+
height: @button-height-mini;
|
|
247
|
+
padding: @button-padding-mini;
|
|
248
|
+
font-size: @button-font-size-mini;
|
|
249
|
+
border-radius: @button-border-radius;
|
|
250
|
+
}
|
|
251
|
+
|
|
252
|
+
// 按钮形状
|
|
253
|
+
.sw-button--circle {
|
|
254
|
+
padding: 0;
|
|
255
|
+
border-radius: @button-circle-border-radius;
|
|
256
|
+
|
|
257
|
+
// 确保圆形按钮有固定的宽高
|
|
258
|
+
&.sw-button--large {
|
|
259
|
+
width: @button-height-large;
|
|
260
|
+
}
|
|
261
|
+
|
|
262
|
+
&.sw-button--normal {
|
|
263
|
+
width: @button-height-normal;
|
|
264
|
+
}
|
|
265
|
+
|
|
266
|
+
&.sw-button--small {
|
|
267
|
+
width: @button-height-small;
|
|
268
|
+
}
|
|
269
|
+
|
|
270
|
+
&.sw-button--mini {
|
|
271
|
+
width: @button-height-mini;
|
|
272
|
+
}
|
|
273
|
+
|
|
274
|
+
.sw-button__icon {
|
|
275
|
+
margin-right: 0;
|
|
276
|
+
}
|
|
277
|
+
}
|
|
278
|
+
|
|
279
|
+
.sw-button--round {
|
|
280
|
+
border-radius: @button-round-border-radius;
|
|
281
|
+
}
|
|
282
|
+
|
|
283
|
+
// 块级按钮
|
|
284
|
+
.is-block {
|
|
285
|
+
display: flex;
|
|
286
|
+
width: 100%;
|
|
287
|
+
align-items: center;
|
|
288
|
+
justify-content: center;
|
|
289
|
+
}
|
|
290
|
+
|
|
291
|
+
// 朴素按钮
|
|
292
|
+
.is-plain {
|
|
293
|
+
background-color: #fff;
|
|
294
|
+
|
|
295
|
+
&.sw-button--primary {
|
|
296
|
+
color: @primary-color;
|
|
297
|
+
border: 1px solid @primary-color;
|
|
298
|
+
}
|
|
299
|
+
|
|
300
|
+
&.sw-button--success {
|
|
301
|
+
color: @success-color;
|
|
302
|
+
border: 1px solid @success-color;
|
|
303
|
+
}
|
|
304
|
+
|
|
305
|
+
&.sw-button--warning {
|
|
306
|
+
color: @warning-color;
|
|
307
|
+
border: 1px solid @warning-color;
|
|
308
|
+
}
|
|
309
|
+
|
|
310
|
+
&.sw-button--danger {
|
|
311
|
+
color: @danger-color;
|
|
312
|
+
border: 1px solid @danger-color;
|
|
313
|
+
}
|
|
314
|
+
|
|
315
|
+
&.sw-button--info {
|
|
316
|
+
color: @info-color;
|
|
317
|
+
border: 1px solid @info-color;
|
|
318
|
+
}
|
|
319
|
+
|
|
320
|
+
&:disabled {
|
|
321
|
+
opacity: 0.4;
|
|
322
|
+
}
|
|
323
|
+
}
|
|
324
|
+
|
|
325
|
+
// 描边按钮
|
|
326
|
+
.is-outline {
|
|
327
|
+
background-color: transparent;
|
|
328
|
+
|
|
329
|
+
&.sw-button--primary {
|
|
330
|
+
color: @primary-color;
|
|
331
|
+
border: 1px solid @primary-color;
|
|
332
|
+
}
|
|
333
|
+
|
|
334
|
+
&.sw-button--success {
|
|
335
|
+
color: @success-color;
|
|
336
|
+
border: 1px solid @success-color;
|
|
337
|
+
}
|
|
338
|
+
|
|
339
|
+
&.sw-button--warning {
|
|
340
|
+
color: @warning-color;
|
|
341
|
+
border: 1px solid @warning-color;
|
|
342
|
+
}
|
|
343
|
+
|
|
344
|
+
&.sw-button--danger {
|
|
345
|
+
color: @danger-color;
|
|
346
|
+
border: 1px solid @danger-color;
|
|
347
|
+
}
|
|
348
|
+
|
|
349
|
+
&.sw-button--info {
|
|
350
|
+
color: @info-color;
|
|
351
|
+
border: 1px solid @info-color;
|
|
352
|
+
}
|
|
353
|
+
}
|
|
354
|
+
|
|
355
|
+
// 链接按钮
|
|
356
|
+
.is-link {
|
|
357
|
+
background-color: transparent;
|
|
358
|
+
border: none;
|
|
359
|
+
padding: 0;
|
|
360
|
+
height: auto;
|
|
361
|
+
line-height: inherit;
|
|
362
|
+
|
|
363
|
+
&.sw-button--primary {
|
|
364
|
+
color: @primary-color;
|
|
365
|
+
}
|
|
366
|
+
|
|
367
|
+
&.sw-button--success {
|
|
368
|
+
color: @success-color;
|
|
369
|
+
}
|
|
370
|
+
|
|
371
|
+
&.sw-button--warning {
|
|
372
|
+
color: @warning-color;
|
|
373
|
+
}
|
|
374
|
+
|
|
375
|
+
&.sw-button--danger {
|
|
376
|
+
color: @danger-color;
|
|
377
|
+
}
|
|
378
|
+
|
|
379
|
+
&.sw-button--info {
|
|
380
|
+
color: @info-color;
|
|
381
|
+
}
|
|
382
|
+
|
|
383
|
+
&:hover {
|
|
384
|
+
text-decoration: underline;
|
|
385
|
+
}
|
|
386
|
+
}
|
|
387
|
+
|
|
388
|
+
// 禁用状态
|
|
389
|
+
.is-disabled {
|
|
390
|
+
opacity: 0.6;
|
|
391
|
+
}
|
|
392
|
+
|
|
393
|
+
// 加载状态
|
|
394
|
+
.is-loading {
|
|
395
|
+
.sw-button__text {
|
|
396
|
+
display: none;
|
|
397
|
+
}
|
|
398
|
+
|
|
399
|
+
.sw-button__loading {
|
|
400
|
+
margin-right: 0;
|
|
401
|
+
}
|
|
402
|
+
}
|
|
403
|
+
|
|
404
|
+
// 动画
|
|
405
|
+
@keyframes spin {
|
|
406
|
+
0% {
|
|
407
|
+
transform: rotate(0deg);
|
|
408
|
+
}
|
|
409
|
+
100% {
|
|
410
|
+
transform: rotate(360deg);
|
|
411
|
+
}
|
|
412
|
+
}
|
|
413
|
+
</style>
|
|
@@ -0,0 +1,160 @@
|
|
|
1
|
+
# Dialog 弹窗组件
|
|
2
|
+
|
|
3
|
+
## 组件名称
|
|
4
|
+
Dialog 弹窗组件
|
|
5
|
+
|
|
6
|
+
## 详细功能描述
|
|
7
|
+
该组件是一个移动端H5页面的弹窗组件,主要用于展示提示信息并提供用户交互按钮。组件支持三种类型的弹窗,具有统一的视觉风格和动画效果。
|
|
8
|
+
|
|
9
|
+
## 主要功能类型
|
|
10
|
+
1. **取消和打开app** - 提供取消和打开app两个按钮
|
|
11
|
+
2. **知道了** - 提供单个确认按钮
|
|
12
|
+
3. **取消和继续访问** - 提供取消和继续访问两个按钮
|
|
13
|
+
|
|
14
|
+
## 组件结构
|
|
15
|
+
- **上部分**:居中显示图标、提示标题和说明文字
|
|
16
|
+
- **下部分**:根据弹窗类型显示不同的按钮组合
|
|
17
|
+
- **背景**:采用assets/u2.png作为背景图
|
|
18
|
+
- **样式**:弹窗圆角、上下部分用灰色分割线分隔
|
|
19
|
+
- **动画**:采用缩放动画形式,居中显示
|
|
20
|
+
|
|
21
|
+
## 属性参数
|
|
22
|
+
|
|
23
|
+
| 参数名 | 类型 | 默认值 | 说明 |
|
|
24
|
+
| ------ | ---- | ------ | ---- |
|
|
25
|
+
| modelValue | Boolean | false | 控制弹窗显示/隐藏(支持v-model) |
|
|
26
|
+
| type | String | 'confirm' | 弹窗类型:open-app(取消和打开app), confirm(知道了), continue(取消和继续访问) |
|
|
27
|
+
| title | String | '' | 弹窗标题 |
|
|
28
|
+
| description | String | '' | 弹窗说明文字 |
|
|
29
|
+
| icon | String | '' | 图标路径 |
|
|
30
|
+
| mask | Boolean | true | 是否显示遮罩层 |
|
|
31
|
+
| maskOpacity | Number | 0.5 | 遮罩层透明度(0-1) |
|
|
32
|
+
| closeOnMaskClick | Boolean | true | 点击遮罩是否关闭弹窗 |
|
|
33
|
+
|
|
34
|
+
## 事件回调
|
|
35
|
+
|
|
36
|
+
| 事件名 | 说明 |
|
|
37
|
+
| ------ | ---- |
|
|
38
|
+
| update:modelValue | v-model双向绑定事件 |
|
|
39
|
+
| confirm | 点击确认按钮(知道了/打开app/继续访问)时触发 |
|
|
40
|
+
| cancel | 点击取消按钮时触发 |
|
|
41
|
+
|
|
42
|
+
## 使用示例代码片段
|
|
43
|
+
|
|
44
|
+
### 基本使用
|
|
45
|
+
```vue
|
|
46
|
+
<template>
|
|
47
|
+
<button @click="showDialog = true">打开弹窗</button>
|
|
48
|
+
|
|
49
|
+
<Dialog v-model="showDialog" title="提示" description="这是一个提示信息">
|
|
50
|
+
</Dialog>
|
|
51
|
+
</template>
|
|
52
|
+
|
|
53
|
+
<script setup>
|
|
54
|
+
import { ref } from 'vue'
|
|
55
|
+
import Dialog from '@/components/MyComs/Dialog/index.vue'
|
|
56
|
+
|
|
57
|
+
const showDialog = ref(false)
|
|
58
|
+
</script>
|
|
59
|
+
```
|
|
60
|
+
|
|
61
|
+
### 类型1: 取消和打开app
|
|
62
|
+
```vue
|
|
63
|
+
<template>
|
|
64
|
+
<button @click="showOpenAppDialog = true">打开app弹窗</button>
|
|
65
|
+
|
|
66
|
+
<Dialog
|
|
67
|
+
v-model="showOpenAppDialog"
|
|
68
|
+
type="open-app"
|
|
69
|
+
title="打开app"
|
|
70
|
+
description="建议您使用app进行操作,体验更佳"
|
|
71
|
+
@confirm="handleOpenApp"
|
|
72
|
+
@cancel="handleCancel"
|
|
73
|
+
>
|
|
74
|
+
</Dialog>
|
|
75
|
+
</template>
|
|
76
|
+
|
|
77
|
+
<script setup>
|
|
78
|
+
import { ref } from 'vue'
|
|
79
|
+
import Dialog from '@/components/MyComs/Dialog/index.vue'
|
|
80
|
+
|
|
81
|
+
const showOpenAppDialog = ref(false)
|
|
82
|
+
|
|
83
|
+
const handleOpenApp = () => {
|
|
84
|
+
console.log('打开app')
|
|
85
|
+
// 打开app的逻辑
|
|
86
|
+
}
|
|
87
|
+
|
|
88
|
+
const handleCancel = () => {
|
|
89
|
+
console.log('取消')
|
|
90
|
+
}
|
|
91
|
+
</script>
|
|
92
|
+
```
|
|
93
|
+
|
|
94
|
+
### 类型2: 知道了
|
|
95
|
+
```vue
|
|
96
|
+
<template>
|
|
97
|
+
<button @click="showConfirmDialog = true">打开知道了弹窗</button>
|
|
98
|
+
|
|
99
|
+
<Dialog
|
|
100
|
+
v-model="showConfirmDialog"
|
|
101
|
+
type="confirm"
|
|
102
|
+
title="提示"
|
|
103
|
+
description="您的操作已完成"
|
|
104
|
+
@confirm="handleConfirm"
|
|
105
|
+
>
|
|
106
|
+
</Dialog>
|
|
107
|
+
</template>
|
|
108
|
+
|
|
109
|
+
<script setup>
|
|
110
|
+
import { ref } from 'vue'
|
|
111
|
+
import Dialog from '@/components/MyComs/Dialog/index.vue'
|
|
112
|
+
|
|
113
|
+
const showConfirmDialog = ref(false)
|
|
114
|
+
|
|
115
|
+
const handleConfirm = () => {
|
|
116
|
+
console.log('知道了')
|
|
117
|
+
}
|
|
118
|
+
</script>
|
|
119
|
+
```
|
|
120
|
+
|
|
121
|
+
### 类型3: 取消和继续访问
|
|
122
|
+
```vue
|
|
123
|
+
<template>
|
|
124
|
+
<button @click="showContinueDialog = true">打开继续访问弹窗</button>
|
|
125
|
+
|
|
126
|
+
<Dialog
|
|
127
|
+
v-model="showContinueDialog"
|
|
128
|
+
type="continue"
|
|
129
|
+
title="提示"
|
|
130
|
+
description="您即将离开当前页面,确定要继续访问吗?"
|
|
131
|
+
@confirm="handleContinue"
|
|
132
|
+
@cancel="handleCancel"
|
|
133
|
+
>
|
|
134
|
+
</Dialog>
|
|
135
|
+
</template>
|
|
136
|
+
|
|
137
|
+
<script setup>
|
|
138
|
+
import { ref } from 'vue'
|
|
139
|
+
import Dialog from '@/components/MyComs/Dialog/index.vue'
|
|
140
|
+
|
|
141
|
+
const showContinueDialog = ref(false)
|
|
142
|
+
|
|
143
|
+
const handleContinue = () => {
|
|
144
|
+
console.log('继续访问')
|
|
145
|
+
// 继续访问的逻辑
|
|
146
|
+
}
|
|
147
|
+
|
|
148
|
+
const handleCancel = () => {
|
|
149
|
+
console.log('取消')
|
|
150
|
+
}
|
|
151
|
+
</script>
|
|
152
|
+
```
|
|
153
|
+
|
|
154
|
+
## 注意事项
|
|
155
|
+
1. 确保在使用v-model时正确绑定布尔值来控制弹窗的显示和隐藏
|
|
156
|
+
2. 根据需要选择合适的弹窗类型
|
|
157
|
+
3. 可以自定义图标路径,若不提供则显示默认图标
|
|
158
|
+
4. 背景图采用assets/u2.png,确保该图片存在
|
|
159
|
+
5. 弹窗使用缩放动画,提供流畅的视觉体验
|
|
160
|
+
6. 弹窗居中显示,适配不同屏幕尺寸
|