uview-plus 3.1.49 → 3.1.51

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/changelog.md CHANGED
@@ -1,3 +1,8 @@
1
+ ## 3.1.51(2024-04-07)
2
+ 优化时间选择器自带输入框格式化显示
3
+ 防止按钮文字换行
4
+ 修复订单列表模板滑动
5
+ 增加u-qrcode二维码组件
1
6
  ## 3.1.49(2024-03-27)
2
7
  日期时间组件支持自带输入框
3
8
  fix: popup弹窗滚动穿透问题
@@ -14,13 +14,14 @@ $u-button-plain-u-button-success-color:$u-success;
14
14
  $u-button-plain-u-button-error-color:$u-error;
15
15
  $u-button-plain-u-button-warning-color:$u-error;
16
16
 
17
- .u-button {
18
- width: 100%;
19
-
20
- &__text {
21
- white-space: nowrap;
22
- line-height: 1;
23
- }
17
+ .u-button {
18
+ width: 100%;
19
+ white-space: nowrap;
20
+
21
+ &__text {
22
+ white-space: nowrap;
23
+ line-height: 1;
24
+ }
24
25
 
25
26
  &:before {
26
27
  position: absolute;
@@ -11,7 +11,7 @@ export default {
11
11
  },
12
12
  format: {
13
13
  type: String,
14
- default: () => 'YYYY-MM-DD HH:mm'
14
+ default: () => ''
15
15
  },
16
16
  // 是否打开组件
17
17
  show: {
@@ -99,7 +99,7 @@
99
99
  // #ifdef VUE3
100
100
  modelValue(newValue) {
101
101
  this.init()
102
- this.inputValue = dayjs(newValue).format(this.format || 'YYYY-MM-DD HH:mm')
102
+ this.getInputValue()
103
103
  },
104
104
  // #endif
105
105
  // #ifdef VUE2
@@ -124,6 +124,34 @@
124
124
  emits: ['close', 'cancel', 'confirm', 'change', 'update:modelValue'],
125
125
  // #endif
126
126
  methods: {
127
+ getInputValue(newValue) {
128
+ if (this.mode == 'time') {
129
+ this.inputValue = newValue
130
+ } else {
131
+ if (this.format) {
132
+ this.inputValue = dayjs(newValue).format(this.format)
133
+ } else {
134
+ let format = ''
135
+ switch (this.mode) {
136
+ case 'date':
137
+ format = 'YYYY-MM-DD'
138
+ break;
139
+ case 'year-month':
140
+ format = 'YYYY-MM'
141
+ break;
142
+ case 'datetime':
143
+ format = 'YYYY-MM-DD HH:mm'
144
+ break;
145
+ case 'time':
146
+ format = 'HH:mm'
147
+ break;
148
+ default:
149
+ break;
150
+ }
151
+ this.inputValue = dayjs(newValue).format(format)
152
+ }
153
+ }
154
+ },
127
155
  init() {
128
156
  // #ifdef VUE3
129
157
  this.innerValue = this.correctValue(this.modelValue)
@@ -156,7 +184,7 @@
156
184
  value: this.innerValue,
157
185
  mode: this.mode
158
186
  })
159
- this.inputValue = dayjs(this.innerValue).format(this.format || 'YYYY-MM-DD HH:mm')
187
+
160
188
  // #ifdef VUE3
161
189
  this.$emit('update:modelValue', this.innerValue)
162
190
  // #endif
@@ -164,6 +192,7 @@
164
192
  this.$emit('input', this.innerValue)
165
193
  // #endif
166
194
  if (this.hasInput) {
195
+ this.getInputValue(this.innerValue)
167
196
  this.showByClickInput = false
168
197
  }
169
198
  },
@@ -287,6 +316,13 @@
287
316
  // 进行过滤
288
317
  if (this.filter) {
289
318
  values = this.filter(type, values)
319
+ if (!values || (values && values.length == 0)) {
320
+ uni.showToast({
321
+ title: '日期filter结果不能为空',
322
+ icon: 'error',
323
+ mask: true
324
+ })
325
+ }
290
326
  }
291
327
  return { type, values }
292
328
  })