sadais-piui 1.2.7-beta113 → 1.2.7-beta114

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.
@@ -280,6 +280,12 @@ export default {
280
280
  default() {
281
281
  return input.clearIcon
282
282
  }
283
+ },
284
+ // 是否失去焦点更新v-model
285
+ updateOnBlur: {
286
+ type: Boolean,
287
+ // true
288
+ default: input.updateOnBlur
283
289
  }
284
290
  },
285
291
  data() {
@@ -347,14 +353,16 @@ export default {
347
353
  // 获得焦点
348
354
  this.$emit('focus')
349
355
  },
350
- handleBlur() {
351
- setTimeout(() => {
352
- this.focused = false
353
- }, 100)
356
+ handleBlur(e) {
357
+ const value = e.detail.value
358
+ if (this.updateOnBlur) {
359
+ this.handleChange(value)
360
+ }
354
361
  this.$emit('blur', value)
355
362
  setTimeout(() => {
363
+ this.focused = false
356
364
  this.dispatch('PiFormItem', 'form-blur', value)
357
- }, 40)
365
+ }, 100)
358
366
  },
359
367
  handleClearInput() {
360
368
  this.handleChange('')
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
  }
package/package.json CHANGED
@@ -1,6 +1,6 @@
1
1
  {
2
2
  "name": "sadais-piui",
3
- "version": "1.2.7-beta113",
3
+ "version": "1.2.7-beta114",
4
4
  "description": "piui组件库",
5
5
  "main": "index.js",
6
6
  "scripts": {