sadais-piui 1.2.7-beta107 → 1.2.7-beta109
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/components/pi-input/index.vue +18 -16
- package/package.json +1 -1
|
@@ -1,5 +1,9 @@
|
|
|
1
1
|
<template>
|
|
2
|
-
<view
|
|
2
|
+
<view
|
|
3
|
+
class="pi-input-wrap"
|
|
4
|
+
:style="[getInputWrapStyle]"
|
|
5
|
+
:class="[{ disabled: getDisabled }]"
|
|
6
|
+
>
|
|
3
7
|
<!-- 当disabled,增加一个abso的蒙层,为了触发click事件 -->
|
|
4
8
|
<view
|
|
5
9
|
v-if="getDisabled"
|
|
@@ -18,7 +22,7 @@
|
|
|
18
22
|
:placeholder="placeholder"
|
|
19
23
|
:placeholder-style="placeholderStyle"
|
|
20
24
|
:placeholder-class="placeholderClass"
|
|
21
|
-
:maxlength="maxlength"
|
|
25
|
+
:maxlength="parseInt(maxlength, 10)"
|
|
22
26
|
:cursor-spacing="cursorSpacing"
|
|
23
27
|
:focus="focus"
|
|
24
28
|
:disabled="getDisabled"
|
|
@@ -32,7 +36,6 @@
|
|
|
32
36
|
:show-confirm-bar="showConfirmbar"
|
|
33
37
|
:auto-height="autoHeight"
|
|
34
38
|
:disable-default-padding="disableDefaultPadding"
|
|
35
|
-
@input="handleInput"
|
|
36
39
|
@focus="handleFocus"
|
|
37
40
|
@blur="handleBlur"
|
|
38
41
|
@confirm="handleConfirm"
|
|
@@ -51,7 +54,7 @@
|
|
|
51
54
|
:placeholder="placeholder"
|
|
52
55
|
:placeholder-style="placeholderStyle"
|
|
53
56
|
:placeholder-class="placeholderClass"
|
|
54
|
-
:maxlength="maxlength"
|
|
57
|
+
:maxlength="parseInt(maxlength, 10)"
|
|
55
58
|
:cursor-spacing="cursorSpacing"
|
|
56
59
|
:focus="focus"
|
|
57
60
|
:disabled="getDisabled"
|
|
@@ -62,7 +65,6 @@
|
|
|
62
65
|
:adjust-position="adjustPosition"
|
|
63
66
|
:hold-keyboard="holdKeyboard"
|
|
64
67
|
:auto-blur="autoBlur"
|
|
65
|
-
@input="handleInput"
|
|
66
68
|
@focus="handleFocus"
|
|
67
69
|
@blur="handleBlur"
|
|
68
70
|
@confirm="handleConfirm"
|
|
@@ -287,7 +289,8 @@ export default {
|
|
|
287
289
|
computed: {
|
|
288
290
|
getDisabled() {
|
|
289
291
|
const parentFormItem = this.$pi.parent(this, 'PiFormItem')
|
|
290
|
-
const disabled =
|
|
292
|
+
const disabled =
|
|
293
|
+
this.disabled || (parentFormItem && parentFormItem.getDisabled)
|
|
291
294
|
return disabled
|
|
292
295
|
},
|
|
293
296
|
getInputWrapStyle() {
|
|
@@ -320,34 +323,33 @@ export default {
|
|
|
320
323
|
methods: {
|
|
321
324
|
async init() {
|
|
322
325
|
if (!this.closeIconWidth) {
|
|
323
|
-
const closeIconRect = await this.$pi.common.queryRect(
|
|
326
|
+
const closeIconRect = await this.$pi.common.queryRect(
|
|
327
|
+
this,
|
|
328
|
+
'.pi-input-close-icon',
|
|
329
|
+
false
|
|
330
|
+
)
|
|
324
331
|
if (closeIconRect && closeIconRect.width) {
|
|
325
332
|
this.closeIconWidth = closeIconRect.width
|
|
326
333
|
}
|
|
327
|
-
// console.log(TAG, '计算.pi-icon宽度', this.closeIconWidth)
|
|
328
334
|
}
|
|
329
335
|
},
|
|
330
336
|
handleItemClick(e) {
|
|
331
337
|
this.$emit('click', e)
|
|
332
338
|
},
|
|
333
|
-
handleInput: debounce(function(e) {
|
|
334
|
-
let value = e.detail.value
|
|
335
|
-
// 输入内容
|
|
336
|
-
this.handleChange(value)
|
|
337
|
-
}, 50),
|
|
338
339
|
handleFocus() {
|
|
339
340
|
this.focused = true
|
|
340
341
|
// 获得焦点
|
|
341
342
|
this.$emit('focus')
|
|
342
343
|
},
|
|
343
344
|
handleBlur(e) {
|
|
345
|
+
const value = e.detail.value
|
|
346
|
+
this.handleChange(value)
|
|
344
347
|
setTimeout(() => {
|
|
345
348
|
this.focused = false
|
|
346
349
|
}, 100)
|
|
347
|
-
|
|
348
|
-
this.$emit('blur', e.detail.value)
|
|
350
|
+
this.$emit('blur', value)
|
|
349
351
|
setTimeout(() => {
|
|
350
|
-
this.dispatch('PiFormItem', 'form-blur',
|
|
352
|
+
this.dispatch('PiFormItem', 'form-blur', value)
|
|
351
353
|
}, 40)
|
|
352
354
|
},
|
|
353
355
|
handleClearInput() {
|