forked from kouchao/vue-layui
-
Notifications
You must be signed in to change notification settings - Fork 0
Expand file tree
/
Copy pathinput.vue
More file actions
58 lines (55 loc) · 1.03 KB
/
input.vue
File metadata and controls
58 lines (55 loc) · 1.03 KB
1
2
3
4
5
6
7
8
9
10
11
12
13
14
15
16
17
18
19
20
21
22
23
24
25
26
27
28
29
30
31
32
33
34
35
36
37
38
39
40
41
42
43
44
45
46
47
48
49
50
51
52
53
54
55
56
57
58
<template>
<div :class="$parent.block ? 'layui-input-block' : 'layui-input-inline'">
<input
:type="type"
:name="name"
:placeholder="placeholder"
class="layui-input"
:value="value"
:disabled="disabled"
:class="{
'layui-radio-disbaled layui-disabled': disabled
}"
@input="handleChange"
>
</div>
</template>
<script>
export default {
name: 'LayInput',
props: {
value: {
type: [String, Number],
default: ''
},
placeholder: {
type: String,
default: ''
},
disabled: Boolean,
type: {
type: String,
default: 'text'
},
name: {
type: String,
default: ''
},
required: Boolean,
width: {
type: Number,
default: 0
},
number: Boolean
},
methods: {
handleChange: function () {
if (!this.disabled) {
const value = event.target.value;
this.$emit('input', this.number ? parseInt(value) || 0 : value);
}
}
}
};
</script>
<style></style>