sadais-piui 1.2.7-beta110 → 1.2.7-beta111

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.
@@ -37,6 +37,7 @@
37
37
  :auto-height="autoHeight"
38
38
  :disable-default-padding="disableDefaultPadding"
39
39
  @focus="handleFocus"
40
+ @input="handleInput"
40
41
  @blur="handleBlur"
41
42
  @confirm="handleConfirm"
42
43
  @keyboardheightchange="$emit('keyboardheightchange', $event)"
@@ -66,6 +67,7 @@
66
67
  :hold-keyboard="holdKeyboard"
67
68
  :auto-blur="autoBlur"
68
69
  @focus="handleFocus"
70
+ @input="handleInput"
69
71
  @blur="handleBlur"
70
72
  @confirm="handleConfirm"
71
73
  @keyboardheightchange="$emit('keyboardheightchange', $event)"
@@ -278,6 +280,12 @@ export default {
278
280
  default() {
279
281
  return input.clearIcon
280
282
  }
283
+ },
284
+ // 是否失去焦点更新v-model
285
+ updateOnBlur: {
286
+ type: Boolean,
287
+ // true
288
+ default: input.updateOnBlur
281
289
  }
282
290
  },
283
291
  data() {
@@ -336,6 +344,12 @@ export default {
336
344
  handleItemClick(e) {
337
345
  this.$emit('click', e)
338
346
  },
347
+ handleInput: debounce(function(e) {
348
+ if (this.updateOnBlur) return
349
+ let value = e.detail.value
350
+ // 输入内容
351
+ this.handleChange(value)
352
+ }, 50),
339
353
  handleFocus() {
340
354
  this.focused = true
341
355
  // 获得焦点
@@ -343,7 +357,9 @@ export default {
343
357
  },
344
358
  handleBlur(e) {
345
359
  const value = e.detail.value
346
- this.handleChange(value)
360
+ if (this.updateOnBlur) {
361
+ this.handleChange(value)
362
+ }
347
363
  setTimeout(() => {
348
364
  this.focused = false
349
365
  }, 100)
@@ -506,7 +506,7 @@ export default {
506
506
  : [])
507
507
  ]
508
508
  }
509
- return extension.filter(ext => !!ext)
509
+ return extension?.filter(ext => !!ext)
510
510
  }
511
511
  },
512
512
  methods: {
package/config/input.js CHANGED
@@ -32,5 +32,6 @@ export default {
32
32
  size: 36,
33
33
  name: 'close-line',
34
34
  color: '#999999'
35
- }
35
+ },
36
+ updateOnBlur: true // 为false时,输入时更新 v-model,为true时,失焦时更新 v-model
36
37
  }
@@ -53,6 +53,7 @@ export default {
53
53
  // 当type为 "image"时生效,调用uni.chooseImage参数
54
54
  chooseImageOpts: {
55
55
  sourceType: ['album', 'camera'], // album 从相册选图,camera 使用相机,默认album
56
+ extension: [], // 允许上传的文件类型,不填则不限制
56
57
  sizeType: ['original', 'compressed'], // original 原图,compressed 压缩图,默认compressed
57
58
  crop: {} // 图像裁剪参数,设置后 sizeType 失效
58
59
  },
package/package.json CHANGED
@@ -1,6 +1,6 @@
1
1
  {
2
2
  "name": "sadais-piui",
3
- "version": "1.2.7-beta110",
3
+ "version": "1.2.7-beta111",
4
4
  "description": "piui组件库",
5
5
  "main": "index.js",
6
6
  "scripts": {