uview-plus 3.1.36 → 3.1.37

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 (63) hide show
  1. package/changelog.md +2 -0
  2. package/components/u-action-sheet/u-action-sheet.vue +1 -0
  3. package/components/u-album/u-album.vue +1 -0
  4. package/components/u-alert/u-alert.vue +1 -0
  5. package/components/u-avatar/u-avatar.vue +1 -0
  6. package/components/u-avatar-group/u-avatar-group.vue +1 -0
  7. package/components/u-back-top/u-back-top.vue +2 -1
  8. package/components/u-badge/u-badge.vue +1 -1
  9. package/components/u-calendar/u-calendar.vue +1 -0
  10. package/components/u-car-keyboard/u-car-keyboard.vue +312 -311
  11. package/components/u-cell/u-cell.vue +1 -1
  12. package/components/u-cell-group/u-cell-group.vue +1 -1
  13. package/components/u-checkbox/u-checkbox.vue +2 -1
  14. package/components/u-code/u-code.vue +1 -0
  15. package/components/u-code-input/props.js +13 -5
  16. package/components/u-code-input/u-code-input.vue +8 -2
  17. package/components/u-col/u-col.vue +1 -0
  18. package/components/u-collapse/u-collapse.vue +1 -0
  19. package/components/u-column-notice/u-column-notice.vue +1 -0
  20. package/components/u-count-down/u-count-down.vue +164 -163
  21. package/components/u-count-to/u-count-to.vue +1 -0
  22. package/components/u-divider/u-divider.vue +1 -0
  23. package/components/u-dropdown/u-dropdown.vue +127 -129
  24. package/components/u-form-item/u-form-item.vue +1 -0
  25. package/components/u-image/u-image.vue +1 -1
  26. package/components/u-index-anchor/u-index-anchor.vue +1 -1
  27. package/components/u-index-item/u-index-item.vue +1 -1
  28. package/components/u-index-list/u-index-list.vue +1 -1
  29. package/components/u-input/u-input.vue +3 -3
  30. package/components/u-keyboard/u-keyboard.vue +1 -0
  31. package/components/u-link/u-link.vue +1 -0
  32. package/components/u-list/u-list.vue +1 -0
  33. package/components/u-loadmore/u-loadmore.vue +1 -0
  34. package/components/u-modal/u-modal.vue +230 -229
  35. package/components/u-navbar/u-navbar.vue +1 -1
  36. package/components/u-no-network/u-no-network.vue +1 -0
  37. package/components/u-notice-bar/u-notice-bar.vue +1 -0
  38. package/components/u-number-box/u-number-box.vue +1 -1
  39. package/components/u-number-keyboard/u-number-keyboard.vue +1 -1
  40. package/components/u-overlay/u-overlay.vue +1 -0
  41. package/components/u-parse/node/node.vue +2 -2
  42. package/components/u-parse/parser.js +1333 -1333
  43. package/components/u-parse/u-parse.vue +3 -3
  44. package/components/u-popup/u-popup.vue +307 -306
  45. package/components/u-radio/u-radio.vue +1 -1
  46. package/components/u-read-more/u-read-more.vue +1 -0
  47. package/components/u-row/u-row.vue +1 -0
  48. package/components/u-row-notice/u-row-notice.vue +1 -0
  49. package/components/u-scroll-list/u-scroll-list.vue +1 -0
  50. package/components/u-search/u-search.vue +6 -2
  51. package/components/u-slider/props.js +13 -5
  52. package/components/u-slider/u-slider.vue +66 -55
  53. package/components/u-status-bar/u-status-bar.vue +1 -1
  54. package/components/u-steps/u-steps.vue +1 -1
  55. package/components/u-steps-item/u-steps-item.vue +1 -1
  56. package/components/u-subsection/u-subsection.vue +1 -0
  57. package/components/u-swiper/u-swiper.vue +10 -9
  58. package/components/u-tabbar-item/u-tabbar-item.vue +1 -0
  59. package/components/u-tag/u-tag.vue +362 -361
  60. package/components/u-toolbar/u-toolbar.vue +1 -0
  61. package/components/u-tooltip/u-tooltip.vue +1 -0
  62. package/components/u-upload/u-upload.vue +1 -1
  63. package/package.json +1 -1
@@ -45,6 +45,7 @@
45
45
  }
46
46
  }
47
47
  },
48
+ emits: ["start", "end", "change"],
48
49
  methods: {
49
50
  checkKeepRunning() {
50
51
  // 获取上一次退出页面(H5还包括刷新)时的时间戳,如果没有上次的保存,此值可能为空
@@ -31,11 +31,19 @@ export default {
31
31
  type: [String, Number],
32
32
  default: defprops.codeInput.space
33
33
  },
34
- // 预置值
35
- value: {
36
- type: [String, Number],
37
- default: defprops.codeInput.value
38
- },
34
+ // #ifdef VUE3
35
+ // 预置值
36
+ modelValue: {
37
+ type: [String, Number],
38
+ default: defprops.codeInput.value
39
+ },
40
+ // #endif
41
+ // #ifdef VUE2
42
+ // 预置值
43
+ value: {
44
+ type: [String, Number],
45
+ default: defprops.codeInput.value
46
+ },
39
47
  // 是否自动获取焦点
40
48
  focus: {
41
49
  type: Boolean,
@@ -51,7 +51,7 @@
51
51
  import mixin from '../../libs/mixin/mixin.js';
52
52
  /**
53
53
  * CodeInput 验证码输入
54
- * @description 该组件一般用于验证用户短信验证码的场景,也可以结合uView的键盘组件使用
54
+ * @description 该组件一般用于验证用户短信验证码的场景,也可以结合uview-plus的键盘组件使用
55
55
  * @tutorial https://ijry.github.io/uview-plus/components/codeInput.html
56
56
  * @property {String | Number} maxlength 最大输入长度 (默认 6 )
57
57
  * @property {Boolean} dot 是否用圆点填充 (默认 false )
@@ -149,6 +149,7 @@
149
149
  return style
150
150
  }
151
151
  },
152
+ emits: ["change", 'finish', "update:modelValue"],
152
153
  methods: {
153
154
  // 监听输入框的值发生变化
154
155
  inputHandler(e) {
@@ -163,7 +164,12 @@
163
164
  // 未达到maxlength之前,发送change事件,达到后发送finish事件
164
165
  this.$emit('change', value)
165
166
  // 修改通过v-model双向绑定的值
166
- this.$emit('input', value)
167
+ // #ifdef VUE3
168
+ this.$emit("update:modelValue", value);
169
+ // #endif
170
+ // #ifdef VUE2
171
+ this.$emit("input", value);
172
+ // #endif
167
173
  // 达到用户指定输入长度时,发出完成事件
168
174
  if (String(value).length >= Number(this.maxlength)) {
169
175
  this.$emit('finish', value)
@@ -81,6 +81,7 @@
81
81
  mounted() {
82
82
  this.init()
83
83
  },
84
+ emits: ["click"],
84
85
  methods: {
85
86
  async init() {
86
87
  // 支付宝小程序不支持provide/inject,所以使用这个方法获取整个父组件,在created定义,避免循环引用
@@ -46,6 +46,7 @@
46
46
  return [this.accordion, this.value]
47
47
  }
48
48
  },
49
+ emits: ["open", "close", "change"],
49
50
  methods: {
50
51
  // 重新初始化一次内部的所有子元素
51
52
  init() {
@@ -107,6 +107,7 @@
107
107
  index:0
108
108
  }
109
109
  },
110
+ emits: ["click", "close"],
110
111
  methods: {
111
112
  noticeChange(e){
112
113
  this.index = e.detail.current
@@ -1,165 +1,166 @@
1
- <template>
2
- <view class="u-count-down">
3
- <slot>
4
- <text class="u-count-down__text">{{ formattedTime }}</text>
5
- </slot>
6
- </view>
7
- </template>
8
-
9
- <script>
1
+ <template>
2
+ <view class="u-count-down">
3
+ <slot>
4
+ <text class="u-count-down__text">{{ formattedTime }}</text>
5
+ </slot>
6
+ </view>
7
+ </template>
8
+
9
+ <script>
10
10
  import props from './props.js';
11
11
  import mpMixin from '../../libs/mixin/mpMixin.js';
12
- import mixin from '../../libs/mixin/mixin.js';
13
- import {
14
- isSameSecond,
15
- parseFormat,
16
- parseTimeData
17
- } from './utils';
18
- /**
19
- * u-count-down 倒计时
20
- * @description 该组件一般使用于某个活动的截止时间上,通过数字的变化,给用户明确的时间感受,提示用户进行某一个行为操作。
21
- * @tutorial https://uviewui.com/components/countDown.html
22
- * @property {String | Number} time 倒计时时长,单位ms (默认 0 )
23
- * @property {String} format 时间格式,DD-日,HH-时,mm-分,ss-秒,SSS-毫秒 (默认 'HH:mm:ss' )
24
- * @property {Boolean} autoStart 是否自动开始倒计时 (默认 true )
25
- * @property {Boolean} millisecond 是否展示毫秒倒计时 (默认 false )
26
- * @event {Function} finish 倒计时结束时触发
27
- * @event {Function} change 倒计时变化时触发
28
- * @event {Function} start 开始倒计时
29
- * @event {Function} pause 暂停倒计时
30
- * @event {Function} reset 重设倒计时,若 auto-start 为 true,重设后会自动开始倒计时
31
- * @example <u-count-down :time="time"></u-count-down>
32
- */
33
- export default {
34
- name: 'u-count-down',
35
- mixins: [mpMixin, mixin, props],
36
- data() {
37
- return {
38
- timer: null,
39
- // 各单位(天,时,分等)剩余时间
40
- timeData: parseTimeData(0),
41
- // 格式化后的时间,如"03:23:21"
42
- formattedTime: '0',
43
- // 倒计时是否正在进行中
44
- runing: false,
45
- endTime: 0, // 结束的毫秒时间戳
46
- remainTime: 0, // 剩余的毫秒时间
47
- }
48
- },
49
- watch: {
50
- time(n) {
51
- this.reset()
52
- }
53
- },
54
- mounted() {
55
- this.init()
56
- },
57
- methods: {
58
- init() {
59
- this.reset()
60
- },
61
- // 开始倒计时
62
- start() {
63
- if (this.runing) return
64
- // 标识为进行中
65
- this.runing = true
66
- // 结束时间戳 = 此刻时间戳 + 剩余的时间
67
- this.endTime = Date.now() + this.remainTime
68
- this.toTick()
69
- },
70
- // 根据是否展示毫秒,执行不同操作函数
71
- toTick() {
72
- if (this.millisecond) {
73
- this.microTick()
74
- } else {
75
- this.macroTick()
76
- }
77
- },
78
- macroTick() {
79
- this.clearTimeout()
80
- // 每隔一定时间,更新一遍定时器的值
81
- // 同时此定时器的作用也能带来毫秒级的更新
82
- this.timer = setTimeout(() => {
83
- // 获取剩余时间
84
- const remain = this.getRemainTime()
85
- // 重设剩余时间
86
- if (!isSameSecond(remain, this.remainTime) || remain === 0) {
87
- this.setRemainTime(remain)
88
- }
89
- // 如果剩余时间不为0,则继续检查更新倒计时
90
- if (this.remainTime !== 0) {
91
- this.macroTick()
92
- }
93
- }, 30)
94
- },
95
- microTick() {
96
- this.clearTimeout()
97
- this.timer = setTimeout(() => {
98
- this.setRemainTime(this.getRemainTime())
99
- if (this.remainTime !== 0) {
100
- this.microTick()
101
- }
102
- }, 50)
103
- },
104
- // 获取剩余的时间
105
- getRemainTime() {
106
- // 取最大值,防止出现小于0的剩余时间值
107
- return Math.max(this.endTime - Date.now(), 0)
108
- },
109
- // 设置剩余的时间
110
- setRemainTime(remain) {
111
- this.remainTime = remain
112
- // 根据剩余的毫秒时间,得出该有天,小时,分钟等的值,返回一个对象
113
- const timeData = parseTimeData(remain)
114
- this.$emit('change', timeData)
115
- // 得出格式化后的时间
116
- this.formattedTime = parseFormat(this.format, timeData)
117
- // 如果时间已到,停止倒计时
118
- if (remain <= 0) {
119
- this.pause()
120
- this.$emit('finish')
121
- }
122
- },
123
- // 重置倒计时
124
- reset() {
125
- this.pause()
126
- this.remainTime = this.time
127
- this.setRemainTime(this.remainTime)
128
- if (this.autoStart) {
129
- this.start()
130
- }
131
- },
132
- // 暂停倒计时
133
- pause() {
134
- this.runing = false;
135
- this.clearTimeout()
136
- },
137
- // 清空定时器
138
- clearTimeout() {
139
- clearTimeout(this.timer)
140
- this.timer = null
141
- }
142
- },
143
- beforeDestroy() {
144
- this.clearTimeout()
145
- }
146
- }
147
- </script>
148
-
149
- <style
150
- lang="scss"
151
- scoped
152
- >
153
- @import "../../libs/css/components.scss";
154
- $u-count-down-text-color:$u-content-color !default;
155
- $u-count-down-text-font-size:15px !default;
156
- $u-count-down-text-line-height:22px !default;
157
-
158
- .u-count-down {
159
- &__text {
160
- color: $u-count-down-text-color;
161
- font-size: $u-count-down-text-font-size;
162
- line-height: $u-count-down-text-line-height;
163
- }
164
- }
165
- </style>
12
+ import mixin from '../../libs/mixin/mixin.js';
13
+ import {
14
+ isSameSecond,
15
+ parseFormat,
16
+ parseTimeData
17
+ } from './utils';
18
+ /**
19
+ * u-count-down 倒计时
20
+ * @description 该组件一般使用于某个活动的截止时间上,通过数字的变化,给用户明确的时间感受,提示用户进行某一个行为操作。
21
+ * @tutorial https://uiadmin.net/uview-plus/components/countDown.html
22
+ * @property {String | Number} time 倒计时时长,单位ms (默认 0 )
23
+ * @property {String} format 时间格式,DD-日,HH-时,mm-分,ss-秒,SSS-毫秒 (默认 'HH:mm:ss' )
24
+ * @property {Boolean} autoStart 是否自动开始倒计时 (默认 true )
25
+ * @property {Boolean} millisecond 是否展示毫秒倒计时 (默认 false )
26
+ * @event {Function} finish 倒计时结束时触发
27
+ * @event {Function} change 倒计时变化时触发
28
+ * @event {Function} start 开始倒计时
29
+ * @event {Function} pause 暂停倒计时
30
+ * @event {Function} reset 重设倒计时,若 auto-start 为 true,重设后会自动开始倒计时
31
+ * @example <u-count-down :time="time"></u-count-down>
32
+ */
33
+ export default {
34
+ name: 'u-count-down',
35
+ mixins: [mpMixin, mixin, props],
36
+ data() {
37
+ return {
38
+ timer: null,
39
+ // 各单位(天,时,分等)剩余时间
40
+ timeData: parseTimeData(0),
41
+ // 格式化后的时间,如"03:23:21"
42
+ formattedTime: '0',
43
+ // 倒计时是否正在进行中
44
+ runing: false,
45
+ endTime: 0, // 结束的毫秒时间戳
46
+ remainTime: 0, // 剩余的毫秒时间
47
+ }
48
+ },
49
+ watch: {
50
+ time(n) {
51
+ this.reset()
52
+ }
53
+ },
54
+ mounted() {
55
+ this.init()
56
+ },
57
+ emits: ["change", "finish"],
58
+ methods: {
59
+ init() {
60
+ this.reset()
61
+ },
62
+ // 开始倒计时
63
+ start() {
64
+ if (this.runing) return
65
+ // 标识为进行中
66
+ this.runing = true
67
+ // 结束时间戳 = 此刻时间戳 + 剩余的时间
68
+ this.endTime = Date.now() + this.remainTime
69
+ this.toTick()
70
+ },
71
+ // 根据是否展示毫秒,执行不同操作函数
72
+ toTick() {
73
+ if (this.millisecond) {
74
+ this.microTick()
75
+ } else {
76
+ this.macroTick()
77
+ }
78
+ },
79
+ macroTick() {
80
+ this.clearTimeout()
81
+ // 每隔一定时间,更新一遍定时器的值
82
+ // 同时此定时器的作用也能带来毫秒级的更新
83
+ this.timer = setTimeout(() => {
84
+ // 获取剩余时间
85
+ const remain = this.getRemainTime()
86
+ // 重设剩余时间
87
+ if (!isSameSecond(remain, this.remainTime) || remain === 0) {
88
+ this.setRemainTime(remain)
89
+ }
90
+ // 如果剩余时间不为0,则继续检查更新倒计时
91
+ if (this.remainTime !== 0) {
92
+ this.macroTick()
93
+ }
94
+ }, 30)
95
+ },
96
+ microTick() {
97
+ this.clearTimeout()
98
+ this.timer = setTimeout(() => {
99
+ this.setRemainTime(this.getRemainTime())
100
+ if (this.remainTime !== 0) {
101
+ this.microTick()
102
+ }
103
+ }, 50)
104
+ },
105
+ // 获取剩余的时间
106
+ getRemainTime() {
107
+ // 取最大值,防止出现小于0的剩余时间值
108
+ return Math.max(this.endTime - Date.now(), 0)
109
+ },
110
+ // 设置剩余的时间
111
+ setRemainTime(remain) {
112
+ this.remainTime = remain
113
+ // 根据剩余的毫秒时间,得出该有天,小时,分钟等的值,返回一个对象
114
+ const timeData = parseTimeData(remain)
115
+ this.$emit('change', timeData)
116
+ // 得出格式化后的时间
117
+ this.formattedTime = parseFormat(this.format, timeData)
118
+ // 如果时间已到,停止倒计时
119
+ if (remain <= 0) {
120
+ this.pause()
121
+ this.$emit('finish')
122
+ }
123
+ },
124
+ // 重置倒计时
125
+ reset() {
126
+ this.pause()
127
+ this.remainTime = this.time
128
+ this.setRemainTime(this.remainTime)
129
+ if (this.autoStart) {
130
+ this.start()
131
+ }
132
+ },
133
+ // 暂停倒计时
134
+ pause() {
135
+ this.runing = false;
136
+ this.clearTimeout()
137
+ },
138
+ // 清空定时器
139
+ clearTimeout() {
140
+ clearTimeout(this.timer)
141
+ this.timer = null
142
+ }
143
+ },
144
+ beforeDestroy() {
145
+ this.clearTimeout()
146
+ }
147
+ }
148
+ </script>
149
+
150
+ <style
151
+ lang="scss"
152
+ scoped
153
+ >
154
+ @import "../../libs/css/components.scss";
155
+ $u-count-down-text-color:$u-content-color !default;
156
+ $u-count-down-text-font-size:15px !default;
157
+ $u-count-down-text-line-height:22px !default;
158
+
159
+ .u-count-down {
160
+ &__text {
161
+ color: $u-count-down-text-color;
162
+ font-size: $u-count-down-text-font-size;
163
+ line-height: $u-count-down-text-line-height;
164
+ }
165
+ }
166
+ </style>
@@ -64,6 +64,7 @@ export default {
64
64
  mounted() {
65
65
  this.autoplay && this.start();
66
66
  },
67
+ emits: ["end"],
67
68
  methods: {
68
69
  easingFn(t, b, c, d) {
69
70
  return (c * (-Math.pow(2, (-10 * t) / d) + 1) * 1024) / 1023 + b;
@@ -82,6 +82,7 @@
82
82
  return style
83
83
  }
84
84
  },
85
+ emits: ["click"],
85
86
  methods: {
86
87
  // divider组件被点击时触发
87
88
  click() {