uview-plus 3.4.24 → 3.4.25

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,10 @@
1
+ ## 3.4.25(2025-04-27)
2
+ fix: up-form编译在微信小程序里样式缺失 #640
3
+
4
+ fix: number-box输入为空时自动设为最小值
5
+
6
+ feat: picker与datetimepicke组件hasInput模式支持inputProps属性
7
+
1
8
  ## 3.4.24(2025-04-25)
2
9
  fix: 修复upload上传逻辑(感谢@semdy)
3
10
 
@@ -32,6 +32,11 @@ export default {
32
32
  confirmColor: '#3c9cff',
33
33
  visibleItemCount: 5,
34
34
  closeOnClickOverlay: false,
35
- defaultIndex: []
35
+ defaultIndex: [],
36
+ inputBorder: 'surround',
37
+ disabled: false,
38
+ disabledColor: '',
39
+ placeholder: '请选择',
40
+ inputProps: {},
36
41
  }
37
42
  }
@@ -7,13 +7,19 @@ export const props = defineMixin({
7
7
  type: Boolean,
8
8
  default: false
9
9
  },
10
+ inputProps: {
11
+ type: Object,
12
+ default: () => {
13
+ return {}
14
+ }
15
+ },
10
16
  inputBorder: {
11
17
  type: String,
12
- default: 'surround'
18
+ default: () => defProps.input.inputBorder
13
19
  },
14
20
  disabled: {
15
21
  type: Boolean,
16
- default: () => false
22
+ default: () => defProps.input.disabled
17
23
  },
18
24
  disabledColor:{
19
25
  type: String,
@@ -21,7 +27,7 @@ export const props = defineMixin({
21
27
  },
22
28
  placeholder: {
23
29
  type: String,
24
- default: () => '请选择'
30
+ default: () => defProps.input.placeholder
25
31
  },
26
32
  format: {
27
33
  type: String,
@@ -5,12 +5,9 @@
5
5
  >
6
6
  <slot name="trigger" :value="inputValue">
7
7
  <up-input
8
- :placeholder="placeholder"
9
8
  :readonly="!!showByClickInput"
10
- :border="inputBorder"
11
9
  v-model="inputValue"
12
- :disabled="disabled"
13
- :disabledColor="disabledColor"
10
+ v-bind="inputPropsInner"
14
11
  ></up-input>
15
12
  <div class="input-cover">
16
13
  </div>
@@ -135,6 +132,16 @@
135
132
  // 如果以下这些变量发生了变化,意味着需要重新初始化各列的值
136
133
  propsChange() {
137
134
  return [this.mode, this.maxDate, this.minDate, this.minHour, this.maxHour, this.minMinute, this.maxMinute, this.filter, ]
135
+ },
136
+ // input的props
137
+ inputPropsInner() {
138
+ return {
139
+ border: this.inputBorder,
140
+ placeholder: this.placeholder,
141
+ disabled: this.disabled,
142
+ disabledColor: this.disabledColor,
143
+ ...this.inputProps
144
+ }
138
145
  }
139
146
  },
140
147
  mounted() {
@@ -240,10 +240,8 @@
240
240
 
241
241
  &__slot {
242
242
  flex: 1;
243
- /* #ifndef MP */
244
243
  @include flex;
245
244
  align-items: center;
246
- /* #endif */
247
245
  }
248
246
 
249
247
  &__icon {
@@ -311,13 +311,17 @@
311
311
  value = ''
312
312
  } = e.detail || {}
313
313
  // 为空返回
314
- if (value === '') return
314
+ if (value === '') {
315
+ // 为空自动设为最小值
316
+ this.emitChange(this.min)
317
+ return
318
+ }
315
319
  let formatted = this.filter(value)
316
320
  // https://github.com/ijry/uview-plus/issues/613
317
321
  this.emitChange(value);
318
322
  // 最大允许的小数长度
319
323
  if (this.decimalLength !== null && formatted.indexOf('.') !== -1) {
320
- const pair = formatted.split('.');
324
+ const pair = formatted.split('.')
321
325
  formatted = `${pair[0]}.${pair[1].slice(0, this.decimalLength)}`
322
326
  }
323
327
  formatted = this.format(formatted)
@@ -27,5 +27,9 @@ export default {
27
27
  defaultIndex: [],
28
28
  immediateChange: true,
29
29
  zIndex: 10076,
30
+ disabled: false,
31
+ disabledColor: '',
32
+ placeholder: '请选择',
33
+ inputProps: {},
30
34
  }
31
35
  }
@@ -6,22 +6,27 @@ export const props = defineMixin({
6
6
  type: Array,
7
7
  default: () => []
8
8
  },
9
- //是否禁用
10
- disabled: {
9
+ hasInput: {
11
10
  type: Boolean,
12
11
  default: false
12
+ },
13
+ inputProps: {
14
+ type: Object,
15
+ default: () => {
16
+ return {}
17
+ }
18
+ },
19
+ disabled: {
20
+ type: Boolean,
21
+ default: () => defProps.picker.disabled
13
22
  },
14
23
  disabledColor:{
15
24
  type: String,
16
- default: () => defProps.input.disabledColor
25
+ default: () => defProps.picker.disabledColor
17
26
  },
18
- hasInput: {
19
- type: Boolean,
20
- default: false
21
- },
22
27
  placeholder: {
23
28
  type: String,
24
- default: () => '请选择'
29
+ default: () => defProps.picker.placeholder
25
30
  },
26
31
  // 是否展示picker弹窗
27
32
  show: {
@@ -1,10 +1,17 @@
1
1
  <template>
2
2
  <view class="u-picker-warrper">
3
- <view v-if="hasInput" class="u-picker-input cursor-pointer" @click="onShowByClickInput">
4
- <slot>
5
- <up-input :disabled="disabled" :disabledColor="disabledColor" :placeholder="placeholder" :readonly="true" border="surround" v-model="inputLabel"></up-input>
6
- <div class="input-cover"></div>
7
- </slot>
3
+ <view v-if="hasInput" class="u-picker-input cursor-pointer" @click="onShowByClickInput">
4
+ <slot :value="inputLabel">
5
+ </slot>
6
+ <slot name="trigger" :value="inputLabel">
7
+ </slot>
8
+ <up-input
9
+ v-if="!$slots['default'] && !$slots['$default'] && !$slots['trigger']"
10
+ :readonly="true"
11
+ v-model="inputLabel"
12
+ v-bind="inputPropsInner">
13
+ </up-input>
14
+ <div class="input-cover"></div>
8
15
  </view>
9
16
  <u-popup
10
17
  :show="show || (hasInput && showByClickInput)"
@@ -122,11 +129,11 @@ export default {
122
129
  immediate: true,
123
130
  deep:true,
124
131
  handler(n,o) {
125
- // 修复uniapp调用子组件直接:defaultIndex="[0]"这样写
126
- // v-model的值变化时候导致defaultIndexwatch也会执行的问题
127
- //单纯vue不会出现
128
- if (!o || n.join("/") != o.join("/")) {
129
- this.setIndexs(n, true)
132
+ // 修复uniapp调用子组件直接:defaultIndex="[0]"这样写
133
+ // v-model的值变化时候导致defaultIndexwatch也会执行的问题
134
+ //单纯vue不会出现
135
+ if (!o || n.join("/") != o.join("/")) {
136
+ this.setIndexs(n, true)
130
137
  }
131
138
  }
132
139
  },
@@ -141,37 +148,47 @@ export default {
141
148
  },
142
149
  emits: ['close', 'cancel', 'confirm', 'change', 'update:modelValue', 'update:show'],
143
150
  computed: {
144
- //已选&&已确认的值显示在input上面的文案
145
- inputLabel() {
146
- let firstItem = this.innerColumns[0] && this.innerColumns[0][0];
147
- // //区分是不是对象数组
148
- if (firstItem && Object.prototype.toString.call(firstItem) === '[object Object]') {
149
- let res = this.innerColumns[0].filter(item => this.modelValue.includes(item['id']))
150
- res = res.map(item => item[this.keyName]);
151
- return res.join("/");
152
-
153
- } else {
154
- //用户确定的值,才显示到输入框
155
- return this.modelValue.join("/");
156
- }
157
- },
158
- //已选,待确认的值
159
- inputValue() {
160
- let items = this.innerColumns.map((item, index) => item[this.innerIndex[index]])
161
- let res = []
162
- //区分是不是对象数组
163
- if (items[0] && Object.prototype.toString.call(items[0]) === '[object Object]') {
164
- //对象数组返回id集合
165
- items.forEach(element => {
166
- res.push(element && element['id'])
167
- });
168
- } else {
169
- //非对象数组返回元素集合
170
- items.forEach((element, index) => {
171
- res.push(element)
172
- });
173
- }
174
- return res
151
+ // input的props
152
+ inputPropsInner() {
153
+ return {
154
+ border: this.inputBorder,
155
+ placeholder: this.placeholder,
156
+ disabled: this.disabled,
157
+ disabledColor: this.disabledColor,
158
+ ...this.inputProps
159
+ }
160
+ },
161
+ //已选&&已确认的值显示在input上面的文案
162
+ inputLabel() {
163
+ let firstItem = this.innerColumns[0] && this.innerColumns[0][0];
164
+ // //区分是不是对象数组
165
+ if (firstItem && Object.prototype.toString.call(firstItem) === '[object Object]') {
166
+ let res = this.innerColumns[0].filter(item => this.modelValue.includes(item['id']))
167
+ res = res.map(item => item[this.keyName]);
168
+ return res.join("/");
169
+
170
+ } else {
171
+ //用户确定的值,才显示到输入框
172
+ return this.modelValue.join("/");
173
+ }
174
+ },
175
+ //已选,待确认的值
176
+ inputValue() {
177
+ let items = this.innerColumns.map((item, index) => item[this.innerIndex[index]])
178
+ let res = []
179
+ //区分是不是对象数组
180
+ if (items[0] && Object.prototype.toString.call(items[0]) === '[object Object]') {
181
+ //对象数组返回id集合
182
+ items.forEach(element => {
183
+ res.push(element && element['id'])
184
+ });
185
+ } else {
186
+ //非对象数组返回元素集合
187
+ items.forEach((element, index) => {
188
+ res.push(element)
189
+ });
190
+ }
191
+ return res
175
192
  }
176
193
  },
177
194
  methods: {
@@ -346,17 +363,17 @@ export default {
346
363
 
347
364
  .u-picker {
348
365
  position: relative;
349
- &-input {
350
- position: relative;
351
- .input-cover {
352
- opacity: 0;
353
- position: absolute;
354
- top: 0;
355
- bottom: 0;
356
- left: 0;
366
+ &-input {
367
+ position: relative;
368
+ .input-cover {
369
+ opacity: 0;
370
+ position: absolute;
371
+ top: 0;
372
+ bottom: 0;
373
+ left: 0;
357
374
  right: 0;
358
- z-index:1;
359
- }
375
+ z-index:1;
376
+ }
360
377
  }
361
378
  &__view {
362
379
 
package/package.json CHANGED
@@ -2,7 +2,7 @@
2
2
  "id": "uview-plus",
3
3
  "name": "uview-plus",
4
4
  "displayName": "零云®uview-plus3.0重磅发布,全面的Vue3鸿蒙移动组件库。",
5
- "version": "3.4.24",
5
+ "version": "3.4.25",
6
6
  "description": "零云®uview-plus已兼容vue3,全面的组件和便捷的工具会让您信手拈来,如鱼得水。",
7
7
  "keywords": [
8
8
  "uview",