sadais-piui 1.2.7-beta73 → 1.2.7-beta74
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 +23 -14
- package/package.json +1 -1
|
@@ -5,11 +5,16 @@
|
|
|
5
5
|
:class="[{ disabled: getDisabled }]"
|
|
6
6
|
@tap="handleItemClick"
|
|
7
7
|
>
|
|
8
|
-
|
|
9
|
-
|
|
10
|
-
|
|
8
|
+
<view
|
|
9
|
+
v-if="type === 'textarea' && readonly"
|
|
10
|
+
class="pi-input-textarea"
|
|
11
|
+
:style="[customStyle, readonlyStyle]"
|
|
12
|
+
:class="[customClass, readonlyClass]"
|
|
13
|
+
>
|
|
14
|
+
{{ val || placeholder }}
|
|
15
|
+
</view>
|
|
11
16
|
<textarea
|
|
12
|
-
v-if="type === 'textarea'"
|
|
17
|
+
v-else-if="type === 'textarea'"
|
|
13
18
|
class="pi-input-textarea"
|
|
14
19
|
:style="[customStyle]"
|
|
15
20
|
:class="[customClass]"
|
|
@@ -18,10 +23,10 @@
|
|
|
18
23
|
:placeholder="placeholder"
|
|
19
24
|
:placeholder-style="placeholderStyle"
|
|
20
25
|
:placeholder-class="placeholderClass"
|
|
26
|
+
:readonly="getDisabled"
|
|
21
27
|
:maxlength="maxlength"
|
|
22
28
|
:cursor-spacing="cursorSpacing"
|
|
23
29
|
:focus="focus"
|
|
24
|
-
:disabled="getDisabled"
|
|
25
30
|
:confirm-hold="confirmHold"
|
|
26
31
|
:cursor="cursor"
|
|
27
32
|
:selection-start="selectionStart"
|
|
@@ -50,10 +55,10 @@
|
|
|
50
55
|
:placeholder="placeholder"
|
|
51
56
|
:placeholder-style="placeholderStyle"
|
|
52
57
|
:placeholder-class="placeholderClass"
|
|
58
|
+
:readonly="getDisabled"
|
|
53
59
|
:maxlength="maxlength"
|
|
54
60
|
:cursor-spacing="cursorSpacing"
|
|
55
61
|
:focus="focus"
|
|
56
|
-
:disabled="getDisabled"
|
|
57
62
|
:confirm-hold="confirmHold"
|
|
58
63
|
:cursor="cursor"
|
|
59
64
|
:selection-start="selectionStart"
|
|
@@ -79,7 +84,7 @@
|
|
|
79
84
|
:color="clearIcon.color"
|
|
80
85
|
:size="clearIcon.size"
|
|
81
86
|
:class-prefix="clearIcon.classPrefix"
|
|
82
|
-
@tap
|
|
87
|
+
@tap="handleChange('')"
|
|
83
88
|
/>
|
|
84
89
|
</view>
|
|
85
90
|
</template>
|
|
@@ -272,6 +277,10 @@ export default {
|
|
|
272
277
|
default() {
|
|
273
278
|
return input.clearIcon
|
|
274
279
|
}
|
|
280
|
+
},
|
|
281
|
+
readonly: {
|
|
282
|
+
type: Boolean,
|
|
283
|
+
default: input.readonly || false
|
|
275
284
|
}
|
|
276
285
|
},
|
|
277
286
|
data() {
|
|
@@ -280,6 +289,12 @@ export default {
|
|
|
280
289
|
}
|
|
281
290
|
},
|
|
282
291
|
computed: {
|
|
292
|
+
readonlyClass() {
|
|
293
|
+
return this.val ? '' : this.placeholderClass
|
|
294
|
+
},
|
|
295
|
+
readonlyStyle() {
|
|
296
|
+
return this.val ? '' : this.placeholderStyle
|
|
297
|
+
},
|
|
283
298
|
getDisabled() {
|
|
284
299
|
const parentFormItem = this.$pi.parent(this, 'PiFormItem')
|
|
285
300
|
const disabled = this.disabled || (parentFormItem && parentFormItem.getDisabled)
|
|
@@ -301,7 +316,6 @@ export default {
|
|
|
301
316
|
},
|
|
302
317
|
methods: {
|
|
303
318
|
handleItemClick(e) {
|
|
304
|
-
console.log(123)
|
|
305
319
|
this.$emit('click', e)
|
|
306
320
|
},
|
|
307
321
|
handleInput: debounce(function(e) {
|
|
@@ -344,18 +358,13 @@ export default {
|
|
|
344
358
|
|
|
345
359
|
<style lang="scss" scoped>
|
|
346
360
|
.pi-input-wrap {
|
|
347
|
-
position: relative;
|
|
348
361
|
width: 100%;
|
|
349
362
|
display: flex;
|
|
350
363
|
align-items: center;
|
|
351
364
|
.pi-input,
|
|
352
365
|
.pi-input-textarea {
|
|
353
366
|
width: 100%;
|
|
354
|
-
|
|
355
|
-
|
|
356
|
-
.pi-input-mask {
|
|
357
|
-
background: transparent;
|
|
358
|
-
z-index: 101;
|
|
367
|
+
flex: 1;
|
|
359
368
|
}
|
|
360
369
|
}
|
|
361
370
|
</style>
|