uview-plus 3.4.93 → 3.4.98

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 (48) hide show
  1. package/changelog.md +17 -0
  2. package/components/u-action-sheet/actionSheet.js +4 -4
  3. package/components/u-action-sheet/props.js +8 -0
  4. package/components/u-action-sheet/u-action-sheet.vue +13 -4
  5. package/components/u-album/album.js +3 -3
  6. package/components/u-album/props.js +9 -0
  7. package/components/u-album/u-album.vue +56 -11
  8. package/components/u-alert/alert.js +9 -5
  9. package/components/u-alert/props.js +29 -0
  10. package/components/u-alert/u-alert.vue +59 -16
  11. package/components/u-avatar/u-avatar.vue +2 -2
  12. package/components/u-back-top/u-back-top.vue +2 -2
  13. package/components/u-button/u-button.vue +5 -5
  14. package/components/u-car-keyboard/u-car-keyboard.vue +2 -2
  15. package/components/u-cell/u-cell.vue +4 -4
  16. package/components/u-checkbox/u-checkbox.vue +1 -1
  17. package/components/u-collapse-item/u-collapse-item.vue +2 -2
  18. package/components/u-column-notice/u-column-notice.vue +6 -6
  19. package/components/u-dropdown/u-dropdown.vue +1 -1
  20. package/components/u-empty/u-empty.vue +2 -2
  21. package/components/u-form-item/u-form-item.vue +2 -2
  22. package/components/u-image/u-image.vue +4 -4
  23. package/components/u-input/u-input.vue +6 -6
  24. package/components/u-navbar/u-navbar.vue +4 -4
  25. package/components/u-no-network/u-no-network.vue +2 -2
  26. package/components/u-notify/u-notify.vue +2 -2
  27. package/components/u-number-box/u-number-box.vue +4 -4
  28. package/components/u-number-keyboard/u-number-keyboard.vue +2 -2
  29. package/components/u-popup/u-popup.vue +2 -2
  30. package/components/u-radio/u-radio.vue +1 -1
  31. package/components/u-rate/u-rate.vue +5 -5
  32. package/components/u-read-more/u-read-more.vue +2 -2
  33. package/components/u-row-notice/u-row-notice.vue +6 -6
  34. package/components/u-search/u-search.vue +4 -4
  35. package/components/u-select/u-select.vue +1 -1
  36. package/components/u-steps-item/u-steps-item.vue +4 -4
  37. package/components/u-swipe-action-item/u-swipe-action-item.vue +2 -2
  38. package/components/u-tabbar-item/u-tabbar-item.vue +2 -2
  39. package/components/u-tag/u-tag.vue +4 -4
  40. package/components/u-text/u-text.vue +4 -4
  41. package/components/u-toast/u-toast.vue +3 -3
  42. package/components/u-upload/u-upload.vue +11 -11
  43. package/package.json +1 -1
  44. package/components/u--form/u--form.vue +0 -85
  45. package/components/u--image/u--image.vue +0 -50
  46. package/components/u--input/u--input.vue +0 -74
  47. package/components/u--text/u--text.vue +0 -45
  48. package/components/u--textarea/u--textarea.vue +0 -47
package/changelog.md CHANGED
@@ -1,3 +1,20 @@
1
+ ## 3.4.98(2025-08-17)
2
+ feat: alert组件新增transitionMode/icon/duration/modelValue等参数
3
+
4
+ improvment: 完善alert组件注释
5
+
6
+ ## 3.4.97(2025-08-16)
7
+ improvment: 完善album组件注释
8
+
9
+ ## 3.4.96(2025-08-16)
10
+ improvment: 完善action-sheet注释
11
+
12
+ ## 3.4.95(2025-08-16)
13
+ del: 去除不再需要的重复组件
14
+
15
+ ## 3.4.94(2025-08-15)
16
+ improvment: 组件库内部icon前缀统一
17
+
1
18
  ## 3.4.93(2025-08-15)
2
19
  fix: 修复dropdown组件在打开下拉菜单时content高度为NANpx的问题
3
20
 
@@ -1,11 +1,11 @@
1
1
  /*
2
2
  * @Author : LQ
3
3
  * @Description :
4
- * @version : 1.0
4
+ * @version : 3.0
5
5
  * @Date : 2021-08-20 16:44:21
6
- * @LastAuthor : LQ
7
- * @lastTime : 2021-08-20 16:44:35
8
- * @FilePath : /u-view2.0/uview-ui/libs/config/props/actionSheet.js
6
+ * @LastAuthor : jry
7
+ * @lastTime : 2025-08-16 10:52:35
8
+ * @FilePath : /uview-plus/libs/config/props/actionSheet.js
9
9
  */
10
10
  export default {
11
11
  // action-sheet组件
@@ -1,3 +1,11 @@
1
+ /*
2
+ * @Author : LQ
3
+ * @Description :
4
+ * @version : 3.0
5
+ * @LastAuthor : jry
6
+ * @lastTime : 2025-08-16 10:52:35
7
+ * @FilePath : /uview-plus/libs/config/props/props.js
8
+ */
1
9
  import { defineMixin } from '../../libs/vue'
2
10
  import defProps from '../../libs/config/props.js'
3
11
 
@@ -1,4 +1,3 @@
1
-
2
1
  <template>
3
2
  <u-popup
4
3
  :show="show"
@@ -8,6 +7,7 @@
8
7
  :round="round"
9
8
  >
10
9
  <view class="u-action-sheet">
10
+ <!-- 顶部标题区域 -->
11
11
  <view
12
12
  class="u-action-sheet__header"
13
13
  v-if="title"
@@ -17,14 +17,15 @@
17
17
  class="u-action-sheet__header__icon-wrap"
18
18
  @tap.stop="cancel"
19
19
  >
20
- <u-icon
20
+ <up-icon
21
21
  name="close"
22
22
  size="17"
23
23
  color="#c8c9cc"
24
24
  bold
25
- ></u-icon>
25
+ ></up-icon>
26
26
  </view>
27
27
  </view>
28
+ <!-- 描述信息 -->
28
29
  <text
29
30
  class="u-action-sheet__description"
30
31
  :style="[{
@@ -33,7 +34,9 @@
33
34
  v-if="description"
34
35
  >{{description}}</text>
35
36
  <slot>
37
+ <!-- 分割线 -->
36
38
  <u-line v-if="description"></u-line>
39
+ <!-- 操作项列表 -->
37
40
  <scroll-view scroll-y class="u-action-sheet__item-wrap" :style="{maxHeight: wrapMaxHeight}">
38
41
  <view :key="index" v-for="(item, index) in actions">
39
42
  <!-- #ifdef MP -->
@@ -73,6 +76,7 @@
73
76
  class="u-action-sheet__item-wrap__item__subname"
74
77
  >{{ item.subname }}</text>
75
78
  </template>
79
+ <!-- 加载状态图标 -->
76
80
  <u-loading-icon
77
81
  v-else
78
82
  custom-class="van-action-sheet__loading"
@@ -83,15 +87,18 @@
83
87
  <!-- #ifdef MP -->
84
88
  </button>
85
89
  <!-- #endif -->
90
+ <!-- 选项间分割线 -->
86
91
  <u-line v-if="index !== actions.length - 1"></u-line>
87
92
  </view>
88
93
  </scroll-view>
89
94
  </slot>
95
+ <!-- 取消按钮前的分割区域 -->
90
96
  <u-gap
91
97
  bgColor="#eaeaec"
92
98
  height="6"
93
99
  v-if="cancelText"
94
100
  ></u-gap>
101
+ <!-- 取消按钮 -->
95
102
  <view class="u-action-sheet__item-wrap__item u-action-sheet__cancel"
96
103
  hover-class="u-action-sheet--hover" @tap="cancel" v-if="cancelText">
97
104
  <text
@@ -168,6 +175,7 @@
168
175
  },
169
176
  emits: ["close", "select", "update:show"],
170
177
  methods: {
178
+ // 关闭操作菜单事件处理
171
179
  closeHandler() {
172
180
  // 允许点击遮罩关闭时,才发出close事件
173
181
  if(this.closeOnClickOverlay) {
@@ -180,6 +188,7 @@
180
188
  this.$emit('update:show', false)
181
189
  this.$emit('close')
182
190
  },
191
+ // 选择操作项处理
183
192
  selectHandler(index) {
184
193
  const item = this.actions[index]
185
194
  if (item && !item.disabled && !item.loading) {
@@ -279,4 +288,4 @@
279
288
  background-color: $u-action-sheet-cancel-text-hover-background-color;
280
289
  }
281
290
  }
282
- </style>
291
+ </style>
@@ -3,9 +3,9 @@
3
3
  * @Description :
4
4
  * @version : 1.0
5
5
  * @Date : 2021-08-20 16:44:21
6
- * @LastAuthor : LQ
7
- * @lastTime : 2021-08-20 16:47:24
8
- * @FilePath : /u-view2.0/uview-ui/libs/config/props/album.js
6
+ * @LastAuthor : jry
7
+ * @lastTime : 2025-08-16 16:32:24
8
+ * @FilePath : /uview-plus/libs/config/props/album.js
9
9
  */
10
10
  export default {
11
11
  // album 组件
@@ -1,5 +1,14 @@
1
+ /*
2
+ * @Author : jry
3
+ * @Description :
4
+ * @version : 3.0
5
+ * @LastAuthor : jry
6
+ * @lastTime : 2025-08-16 16:35:24
7
+ * @FilePath : /uview-plus/components/u-album/props.js
8
+ */
1
9
  import { defineMixin } from '../../libs/vue'
2
10
  import defProps from '../../libs/config/props.js'
11
+
3
12
  export const props = defineMixin({
4
13
  props: {
5
14
  // 图片地址,Array<String>|Array<Object>形式
@@ -1,5 +1,6 @@
1
1
  <template>
2
2
  <view class="u-album">
3
+ <!-- 相册行容器,每行显示 rowCount 个图片 -->
3
4
  <view
4
5
  class="u-album__row"
5
6
  ref="u-album__row"
@@ -8,6 +9,7 @@
8
9
  :key="index"
9
10
  :style="{flexWrap: autoWrap ? 'wrap' : 'nowrap'}"
10
11
  >
12
+ <!-- 图片包装容器 -->
11
13
  <view
12
14
  class="u-album__row__wrapper"
13
15
  v-for="(item, index1) in arr"
@@ -15,6 +17,7 @@
15
17
  :style="[imageStyle(index + 1, index1 + 1)]"
16
18
  @tap="onPreviewTap($event, getSrc(item))"
17
19
  >
20
+ <!-- 图片显示 -->
18
21
  <image
19
22
  :src="getSrc(item)"
20
23
  :mode="
@@ -32,6 +35,7 @@
32
35
  }
33
36
  ]"
34
37
  ></image>
38
+ <!-- 超出最大显示数量时的更多提示 -->
35
39
  <view
36
40
  v-if="
37
41
  showMore &&
@@ -64,7 +68,7 @@ import { mixin } from '../../libs/mixin/mixin';
64
68
  import { addUnit, sleep } from '../../libs/function/index';
65
69
  import test from '../../libs/function/test';
66
70
  // #ifdef APP-NVUE
67
- // 由于weex为阿里的KPI业绩考核的产物,所以不支持百分比单位,这里需要通过dom查询组件的宽度
71
+ // 不支持百分比单位,这里需要通过dom查询组件的宽度
68
72
  const dom = uni.requireNativePlugin('dom')
69
73
  // #endif
70
74
 
@@ -108,6 +112,7 @@ export default {
108
112
  urls: {
109
113
  immediate: true,
110
114
  handler(newVal) {
115
+ // 当只有一张图片时,获取图片尺寸信息
111
116
  if (newVal.length === 1) {
112
117
  this.getImageRect()
113
118
  }
@@ -115,6 +120,12 @@ export default {
115
120
  }
116
121
  },
117
122
  computed: {
123
+ /**
124
+ * 计算图片样式
125
+ * @param {Number} index1 - 行索引
126
+ * @param {Number} index2 - 列索引
127
+ * @returns {Object} 图片样式对象
128
+ */
118
129
  imageStyle() {
119
130
  return (index1, index2) => {
120
131
  const { space, rowCount, multipleSize, urls } = this,
@@ -138,11 +149,16 @@ export default {
138
149
  return style
139
150
  }
140
151
  },
141
- // 将数组划分为二维数组
152
+ /**
153
+ * 将图片地址数组划分为二维数组,用于按行显示
154
+ * @returns {Array} 二维数组,每个子数组代表一行图片
155
+ */
142
156
  showUrls() {
143
157
  if (this.autoWrap) {
158
+ // 自动换行模式下,所有图片放在一行中显示
144
159
  return [ this.urls.slice(0, this.maxCount) ];
145
160
  } else {
161
+ // 固定行数模式下,按 rowCount 分割图片
146
162
  const arr = []
147
163
  this.urls.map((item, index) => {
148
164
  // 限制最大展示数量
@@ -159,18 +175,29 @@ export default {
159
175
  return arr
160
176
  }
161
177
  },
178
+ /**
179
+ * 计算图片宽度
180
+ * @returns {String} 图片宽度样式值
181
+ */
162
182
  imageWidth() {
163
183
  return addUnit(
164
184
  this.urls.length === 1 ? this.singleWidth : this.multipleSize, this.unit
165
185
  )
166
186
  },
187
+ /**
188
+ * 计算图片高度
189
+ * @returns {String} 图片高度样式值
190
+ */
167
191
  imageHeight() {
168
192
  return addUnit(
169
193
  this.urls.length === 1 ? this.singleHeight : this.multipleSize, this.unit
170
194
  )
171
195
  },
172
- // 此变量无实际用途,仅仅是为了利用computed特性,让其在urls长度等变化时,重新计算图片的宽度
173
- // 因为用户在某些特殊的情况下,需要让文字与相册的宽度相等,所以这里事件的形式对外发送
196
+ /**
197
+ * 计算相册总宽度,用于外部组件对齐
198
+ * 此变量无实际用途,仅仅是为了利用computed特性,让其在urls长度等变化时,重新计算图片的宽度
199
+ * @returns {Number} 相册宽度
200
+ */
174
201
  albumWidth() {
175
202
  let width = 0
176
203
  if (this.urls.length === 1) {
@@ -187,12 +214,18 @@ export default {
187
214
  emits: ['preview', 'albumWidth'],
188
215
  methods: {
189
216
  addUnit,
190
- // 预览图片
217
+ /**
218
+ * 点击图片预览
219
+ * @param {Event} e - 点击事件对象
220
+ * @param {String} url - 当前点击图片的地址
221
+ */
191
222
  onPreviewTap(e, url) {
223
+ // 获取所有图片地址
192
224
  const urls = this.urls.map((item) => {
193
225
  return this.getSrc(item)
194
226
  })
195
227
  if (this.previewFullImage) {
228
+ // 使用系统默认预览图片功能
196
229
  uni.previewImage({
197
230
  current: url,
198
231
  urls
@@ -200,21 +233,28 @@ export default {
200
233
  // 是否阻止事件传播
201
234
  this.stop && this.preventEvent(e)
202
235
  } else {
236
+ // 发送自定义预览事件
203
237
  this.$emit('preview', {
204
238
  urls,
205
239
  currentIndex: urls.indexOf(url)
206
240
  })
207
241
  }
208
242
  },
209
- // 获取图片的路径
243
+ /**
244
+ * 获取图片地址
245
+ * @param {String|Object} item - 图片项,可以是字符串或对象
246
+ * @returns {String} 图片地址
247
+ */
210
248
  getSrc(item) {
211
249
  return test.object(item)
212
250
  ? (this.keyName && item[this.keyName]) || item.src
213
251
  : item
214
252
  },
215
- // 单图时,获取图片的尺寸
216
- // 在小程序中,需要将网络图片的的域名添加到小程序的download域名才可能获取尺寸
217
- // 在没有添加的情况下,让单图宽度默认为盒子的一定宽度(singlePercent)
253
+ /**
254
+ * 单图时,获取图片的尺寸
255
+ * 在小程序中,需要将网络图片的的域名添加到小程序的download域名才可能获取尺寸
256
+ * 在没有添加的情况下,让单图宽度默认为盒子的一定宽度(singlePercent)
257
+ */
218
258
  getImageRect() {
219
259
  const src = this.getSrc(this.urls[0])
220
260
  uni.getImageInfo({
@@ -245,21 +285,26 @@ export default {
245
285
  }
246
286
  },
247
287
  fail: () => {
288
+ // 获取图片信息失败时,通过组件宽度计算
248
289
  this.getComponentWidth()
249
290
  }
250
291
  })
251
292
  },
252
- // 获取组件的宽度
293
+ /**
294
+ * 获取组件的宽度,用于计算单图显示尺寸
295
+ */
253
296
  async getComponentWidth() {
254
297
  // 延时一定时间,以获取dom尺寸
255
298
  await sleep(30)
256
299
  // #ifndef APP-NVUE
300
+ // H5、小程序等平台通过 $uGetRect 获取组件宽度
257
301
  this.$uGetRect('.u-album__row').then((size) => {
258
302
  this.singleWidth = size.width * this.singlePercent
259
303
  })
260
304
  // #endif
261
305
 
262
306
  // #ifdef APP-NVUE
307
+ // NVUE 平台通过 dom 插件获取组件宽度
263
308
  // 这里ref="u-album__row"所在的标签为通过for循环出来,导致this.$refs['u-album__row']是一个数组
264
309
  const ref = this.$refs['u-album__row'][0]
265
310
  ref &&
@@ -296,4 +341,4 @@ export default {
296
341
  }
297
342
  }
298
343
  }
299
- </style>
344
+ </style>
@@ -1,11 +1,11 @@
1
1
  /*
2
2
  * @Author : LQ
3
3
  * @Description :
4
- * @version : 1.0
4
+ * @version : 3.0
5
5
  * @Date : 2021-08-20 16:44:21
6
- * @LastAuthor : LQ
7
- * @lastTime : 2021-08-20 16:48:53
8
- * @FilePath : /u-view2.0/uview-ui/libs/config/props/alert.js
6
+ * @LastAuthor : jry
7
+ * @lastTime : 2025-08-17 17:23:53
8
+ * @FilePath : /uview-plus/libs/config/props/alert.js
9
9
  */
10
10
  export default {
11
11
  // alert警告组件
@@ -17,6 +17,10 @@ export default {
17
17
  showIcon: false,
18
18
  effect: 'light',
19
19
  center: false,
20
- fontSize: 14
20
+ fontSize: 14,
21
+ transitionMode: 'fade',
22
+ duration: 0,
23
+ icon: '',
24
+ value: true
21
25
  }
22
26
  }
@@ -1,5 +1,14 @@
1
+ /*
2
+ * @Author : jry
3
+ * @Description :
4
+ * @version : 3.0
5
+ * @LastAuthor : jry
6
+ * @lastTime : 2025-08-17 17:23:53
7
+ * @FilePath : /uview-plus/libs/config/props/props.js
8
+ */
1
9
  import { defineMixin } from '../../libs/vue'
2
10
  import defProps from '../../libs/config/props.js'
11
+
3
12
  export const props = defineMixin({
4
13
  props: {
5
14
  // 显示文字
@@ -41,6 +50,26 @@ export const props = defineMixin({
41
50
  fontSize: {
42
51
  type: [String, Number],
43
52
  default: () => defProps.alert.fontSize
53
+ },
54
+ // 动画类型
55
+ transitionMode: {
56
+ type: [String],
57
+ default: () => defProps.alert.transitionMode
58
+ },
59
+ // 自动定时关闭毫秒
60
+ duration: {
61
+ type: [Number],
62
+ default: () => defProps.alert.duration
63
+ },
64
+ // 自定义图标
65
+ icon: {
66
+ type: [String],
67
+ default: () => defProps.alert.icon
68
+ },
69
+ // 是否显示
70
+ modelValue: {
71
+ type: [String],
72
+ default: () => defProps.alert.value
44
73
  }
45
74
  }
46
75
  })
@@ -1,6 +1,6 @@
1
1
  <template>
2
- <u-transition
3
- mode="fade"
2
+ <up-transition
3
+ :mode="transitionMode"
4
4
  :show="show"
5
5
  >
6
6
  <view
@@ -9,22 +9,25 @@
9
9
  @tap.stop="clickHandler"
10
10
  :style="[addStyle(customStyle)]"
11
11
  >
12
+ <!-- 左侧图标 -->
12
13
  <view
13
14
  class="u-alert__icon"
14
15
  v-if="showIcon"
15
16
  >
16
- <u-icon
17
+ <up-icon
17
18
  :name="iconName"
18
19
  size="18"
19
20
  :color="iconColor"
20
- ></u-icon>
21
+ ></up-icon>
21
22
  </view>
23
+ <!-- 内容区域 -->
22
24
  <view
23
25
  class="u-alert__content"
24
26
  :style="[{
25
27
  paddingRight: closable ? '20px' : 0
26
28
  }]"
27
29
  >
30
+ <!-- 标题 -->
28
31
  <text
29
32
  class="u-alert__content__title"
30
33
  v-if="title"
@@ -34,6 +37,7 @@
34
37
  }]"
35
38
  :class="[effect === 'dark' ? 'u-alert__text--dark' : `u-alert__text--${type}--light`]"
36
39
  >{{ title }}</text>
40
+ <!-- 描述信息 -->
37
41
  <text
38
42
  class="u-alert__content__desc"
39
43
  v-if="description"
@@ -44,19 +48,22 @@
44
48
  :class="[effect === 'dark' ? 'u-alert__text--dark' : `u-alert__text--${type}--light`]"
45
49
  >{{ description }}</text>
46
50
  </view>
51
+ <!-- 关闭按钮 -->
47
52
  <view
48
53
  class="u-alert__close"
49
54
  v-if="closable"
50
55
  @tap.stop="closeHandler"
51
56
  >
52
- <u-icon
53
- name="close"
54
- :color="iconColor"
55
- size="15"
56
- ></u-icon>
57
+ <slot name="close">
58
+ <up-icon
59
+ name="close"
60
+ :color="iconColor"
61
+ size="15"
62
+ ></up-icon>
63
+ </slot>
57
64
  </view>
58
65
  </view>
59
- </u-transition>
66
+ </up-transition>
60
67
  </template>
61
68
 
62
69
  <script>
@@ -70,7 +77,7 @@
70
77
  * @tutorial https://ijry.github.io/uview-plus/components/alertTips.html
71
78
  *
72
79
  * @property {String} title 显示的文字
73
- * @property {String} type 使用预设的颜色 (默认 'warning' )
80
+ * @property {String} type 使用预设的颜色 (默认 'warning' )
74
81
  * @property {String} description 辅助性文字,颜色比title浅一点,字号也小一点,可选
75
82
  * @property {Boolean} closable 关闭按钮(默认为叉号icon图标) (默认 false )
76
83
  * @property {Boolean} showIcon 是否显示左边的辅助图标 ( 默认 false )
@@ -78,24 +85,34 @@
78
85
  * @property {Boolean} center 文字是否居中 (默认 false )
79
86
  * @property {String | Number} fontSize 字体大小 (默认 14 )
80
87
  * @property {Object} customStyle 定义需要用到的外部样式
88
+ * @property {String} transitionMode 过渡动画模式 (默认 'fade' )
89
+ * @property {String | Number} duration 自动关闭延时(毫秒),设置为0或负数则不自动关闭 (默认 0 )
90
+ * @property {String} icon 自定义图标名称,优先级高于type默认图标
91
+ * @property {Boolean} modelValue/v-model 绑定值,控制是否显示 (默认 true )
81
92
  * @event {Function} click 点击组件时触发
82
93
  * @event {Function} close 点击关闭按钮时触发
83
- * @example <u-alert :title="title" type = "warning" :closable="closable" :description = "description"></u-alert>
94
+ * @event {Function} closed 关闭动画结束时触发
95
+ * @example <up-alert :title="title" type = "warning" :closable="closable" :description = "description"></up-alert>
84
96
  */
85
97
  export default {
86
98
  name: 'u-alert',
87
99
  mixins: [mpMixin, mixin, props],
88
100
  data() {
89
101
  return {
102
+ // 控制组件显示隐藏
90
103
  show: true
91
104
  }
92
105
  },
93
106
  computed: {
107
+ // 根据不同的主题类型返回对应的图标颜色
94
108
  iconColor() {
95
109
  return this.effect === 'light' ? this.type : '#fff'
96
110
  },
97
111
  // 不同主题对应不同的图标
98
112
  iconName() {
113
+ // 如果用户自定义了图标,则优先使用自定义图标
114
+ if (this.icon) return this.icon;
115
+
99
116
  switch (this.type) {
100
117
  case 'success':
101
118
  return 'checkmark-circle-fill';
@@ -117,18 +134,44 @@
117
134
  }
118
135
  }
119
136
  },
120
- emits: ["click","close"],
137
+ emits: ["click","close", "closed", "update:modelValue"],
138
+ watch: {
139
+ modelValue: {
140
+ handler(newVal) {
141
+ this.show = newVal;
142
+ },
143
+ immediate: true
144
+ },
145
+ show: {
146
+ handler(newVal) {
147
+ this.$emit('update:modelValue', newVal);
148
+
149
+ // 如果是从显示到隐藏,且启用了自动关闭功能
150
+ if (!newVal && this.duration > 0) {
151
+ this.$emit('closed');
152
+ }
153
+ }
154
+ }
155
+ },
156
+ mounted() {
157
+ // 如果设置了自动关闭时间,则在指定时间后自动关闭
158
+ if (this.duration > 0) {
159
+ setTimeout(() => {
160
+ this.closeHandler();
161
+ }, this.duration);
162
+ }
163
+ },
121
164
  methods: {
122
165
  addUnit,
123
166
  addStyle,
124
- // 点击内容
167
+ // 点击内容区域触发click事件
125
168
  clickHandler() {
126
169
  this.$emit('click')
127
170
  },
128
- // 点击关闭按钮
171
+ // 点击关闭按钮触发close事件并隐藏组件
129
172
  closeHandler() {
130
173
  this.show = false
131
- this.$emit('close')
174
+ this.$emit('close');
132
175
  }
133
176
  }
134
177
  }
@@ -23,12 +23,12 @@
23
23
  <!-- #ifndef MP-WEIXIN && MP-QQ && MP-BAIDU -->
24
24
  <template v-if="mpAvatar && allowMp"></template>
25
25
  <!-- #endif -->
26
- <u-icon
26
+ <up-icon
27
27
  v-else-if="icon"
28
28
  :name="icon"
29
29
  :size="fontSize"
30
30
  :color="color"
31
- ></u-icon>
31
+ ></up-icon>
32
32
  <up-text
33
33
  v-else-if="text"
34
34
  :text="text"
@@ -10,10 +10,10 @@
10
10
  v-if="!$slots.default && !$slots.$default"
11
11
  @click="backToTop"
12
12
  >
13
- <u-icon
13
+ <up-icon
14
14
  :name="icon"
15
15
  :custom-style="iconStyle"
16
- ></u-icon>
16
+ ></up-icon>
17
17
  <text
18
18
  v-if="text"
19
19
  class="u-back-top__text"
@@ -39,13 +39,13 @@
39
39
  >
40
40
  </template>
41
41
  <template v-else>
42
- <u-icon
42
+ <up-icon
43
43
  v-if="icon"
44
44
  :name="icon"
45
45
  :color="iconColorCom"
46
46
  :size="textSize * 1.35"
47
47
  :customStyle="{ marginRight: '2px' }"
48
- ></u-icon>
48
+ ></up-icon>
49
49
  <slot>
50
50
  <text
51
51
  class="u-button__text"
@@ -87,12 +87,12 @@
87
87
  >
88
88
  </template>
89
89
  <template v-else>
90
- <u-icon
90
+ <up-icon
91
91
  v-if="icon"
92
92
  :name="icon"
93
93
  :color="iconColorCom"
94
94
  :size="textSize * 1.35"
95
- ></u-icon>
95
+ ></up-icon>
96
96
  <text
97
97
  class="u-button__text"
98
98
  :style="[
@@ -206,7 +206,7 @@ export default {
206
206
  },
207
207
  iconColorCom() {
208
208
  // 如果是镂空状态,设置了color就用color值,否则使用主题颜色,
209
- // u-icon的color能接受一个主题颜色的值
209
+ // up-icon的color能接受一个主题颜色的值
210
210
  if (this.iconColor) return this.iconColor;
211
211
  if (this.plain) {
212
212
  return this.color ? this.color : this.type;
@@ -56,11 +56,11 @@
56
56
  hover-class="u-hover-class"
57
57
  :hover-stay-time="200"
58
58
  >
59
- <u-icon
59
+ <up-icon
60
60
  size="28"
61
61
  name="backspace"
62
62
  color="#303133"
63
- ></u-icon>
63
+ ></up-icon>
64
64
  </view>
65
65
  </view>
66
66
  </view>