uniapp-dyckui 4.1.6 → 4.1.8

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.
@@ -1,160 +1,218 @@
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. 弹窗使用缩放动画,提供流畅的视觉体验
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
+ | iconType | String | '' | 图标类型:phone、screen、links、links2 |
31
+ | customIcon | String | '' | 自定义字体图标 |
32
+ | mask | Boolean | true | 是否显示遮罩层 |
33
+ | maskOpacity | Number | 0.5 | 遮罩层透明度(0-1) |
34
+ | closeOnMaskClick | Boolean | true | 点击遮罩是否关闭弹窗 |
35
+
36
+ ## 插槽
37
+
38
+ | 插槽名 | 说明 |
39
+ | ------ | ---- |
40
+ | icon | 自定义图标插槽,用于完全自定义弹窗图标 |
41
+
42
+ ## 事件回调
43
+
44
+ | 事件名 | 说明 |
45
+ | ------ | ---- |
46
+ | update:modelValue | v-model双向绑定事件 |
47
+ | confirm | 点击确认按钮(知道了/打开app/继续访问)时触发 |
48
+ | cancel | 点击取消按钮时触发 |
49
+
50
+ ## 使用示例代码片段
51
+
52
+ ### 基本使用
53
+ ```vue
54
+ <template>
55
+ <button @click="showDialog = true">打开弹窗</button>
56
+
57
+ <Dialog v-model="showDialog" title="提示" description="这是一个提示信息">
58
+ </Dialog>
59
+ </template>
60
+
61
+ <script setup>
62
+ import { ref } from 'vue'
63
+ import Dialog from '@/components/MyComs/Dialog/index.vue'
64
+
65
+ const showDialog = ref(false)
66
+ </script>
67
+ ```
68
+
69
+ ### 类型1: 取消和打开app
70
+ ```vue
71
+ <template>
72
+ <button @click="showOpenAppDialog = true">打开app弹窗</button>
73
+
74
+ <Dialog
75
+ v-model="showOpenAppDialog"
76
+ type="open-app"
77
+ title="打开app"
78
+ description="建议您使用app进行操作,体验更佳"
79
+ @confirm="handleOpenApp"
80
+ @cancel="handleCancel"
81
+ >
82
+ </Dialog>
83
+ </template>
84
+
85
+ <script setup>
86
+ import { ref } from 'vue'
87
+ import Dialog from '@/components/MyComs/Dialog/index.vue'
88
+
89
+ const showOpenAppDialog = ref(false)
90
+
91
+ const handleOpenApp = () => {
92
+ console.log('打开app')
93
+ // 打开app的逻辑
94
+ }
95
+
96
+ const handleCancel = () => {
97
+ console.log('取消')
98
+ }
99
+ </script>
100
+ ```
101
+
102
+ ### 类型2: 知道了
103
+ ```vue
104
+ <template>
105
+ <button @click="showConfirmDialog = true">打开知道了弹窗</button>
106
+
107
+ <Dialog
108
+ v-model="showConfirmDialog"
109
+ type="confirm"
110
+ title="提示"
111
+ description="您的操作已完成"
112
+ @confirm="handleConfirm"
113
+ >
114
+ </Dialog>
115
+ </template>
116
+
117
+ <script setup>
118
+ import { ref } from 'vue'
119
+ import Dialog from '@/components/MyComs/Dialog/index.vue'
120
+
121
+ const showConfirmDialog = ref(false)
122
+
123
+ const handleConfirm = () => {
124
+ console.log('知道了')
125
+ }
126
+ </script>
127
+ ```
128
+
129
+ ### 类型3: 取消和继续访问
130
+ ```vue
131
+ <template>
132
+ <button @click="showContinueDialog = true">打开继续访问弹窗</button>
133
+
134
+ <Dialog
135
+ v-model="showContinueDialog"
136
+ type="continue"
137
+ title="提示"
138
+ description="您即将离开当前页面,确定要继续访问吗?"
139
+ @confirm="handleContinue"
140
+ @cancel="handleCancel"
141
+ >
142
+ </Dialog>
143
+ </template>
144
+
145
+ <script setup>
146
+ import { ref } from 'vue'
147
+ import Dialog from '@/components/MyComs/Dialog/index.vue'
148
+
149
+ const showContinueDialog = ref(false)
150
+
151
+ const handleContinue = () => {
152
+ console.log('继续访问')
153
+ // 继续访问的逻辑
154
+ }
155
+
156
+ const handleCancel = () => {
157
+ console.log('取消')
158
+ }
159
+ </script>
160
+ ```
161
+
162
+ ### 使用自定义插槽
163
+ ```vue
164
+ <template>
165
+ <button @click="showContinueDialog = true">打开继续访问弹窗</button>
166
+
167
+ <Dialog
168
+ v-model="showContinueDialog"
169
+ type="continue"
170
+ title="提示"
171
+ description="您即将离开当前页面,确定要继续访问吗?"
172
+ @confirm="handleContinue"
173
+ @cancel="handleCancel"
174
+ >
175
+ <!-- 使用自定义插槽完全自定义图标 -->
176
+ <template #icon>
177
+ <text class="iconfont dialog-button-primary icon-xianshiqi1" />
178
+ </template>
179
+ </Dialog>
180
+ </template>
181
+
182
+ <script setup>
183
+ import { ref } from 'vue'
184
+ import Dialog from '@/components/MyComs/Dialog/index.vue'
185
+
186
+ const showContinueDialog = ref(false)
187
+
188
+ const handleContinue = () => {
189
+ console.log('继续访问')
190
+ // 继续访问的逻辑
191
+ }
192
+
193
+ const handleCancel = () => {
194
+ console.log('取消')
195
+ }
196
+ </script>
197
+
198
+ <style scoped>
199
+ /* 自定义插槽图标的样式 */
200
+ .icon-xianshiqi1 {
201
+ width: 120rpx;
202
+ height: 120rpx;
203
+ font-size: 80rpx;
204
+ display: flex;
205
+ justify-content: center;
206
+ align-items: center;
207
+ color: #00599c;
208
+ }
209
+ </style>
210
+ ```
211
+
212
+ ## 注意事项
213
+ 1. 确保在使用v-model时正确绑定布尔值来控制弹窗的显示和隐藏
214
+ 2. 根据需要选择合适的弹窗类型
215
+ 3. 可以自定义图标路径,若不提供则显示默认图标
216
+ 4. 背景图采用assets/u2.png,确保该图片存在
217
+ 5. 弹窗使用缩放动画,提供流畅的视觉体验
160
218
  6. 弹窗居中显示,适配不同屏幕尺寸