Fix bug
This commit is contained in:
parent
3dde561fe5
commit
187792dfc4
@ -5,10 +5,9 @@
|
|||||||
<span class="label" ref="label"><slot name="label"></slot></span>
|
<span class="label" ref="label"><slot name="label"></slot></span>
|
||||||
<div class="prefix" ref="prefix"><slot name="prefix"></slot></div>
|
<div class="prefix" ref="prefix"><slot name="prefix"></slot></div>
|
||||||
<select ref="input"
|
<select ref="input"
|
||||||
:value="v"
|
v-model="v"
|
||||||
:required="required"
|
:required="required"
|
||||||
:disabled="disabled"
|
:disabled="disabled"
|
||||||
@input="$emit('input', $event.target.value)"
|
|
||||||
@focus="focused = true"
|
@focus="focused = true"
|
||||||
@blur="focused = false"
|
@blur="focused = false"
|
||||||
>
|
>
|
||||||
@ -56,20 +55,22 @@ export default Vue.extend({
|
|||||||
},
|
},
|
||||||
data() {
|
data() {
|
||||||
return {
|
return {
|
||||||
v: this.value,
|
|
||||||
focused: false
|
focused: false
|
||||||
};
|
};
|
||||||
},
|
},
|
||||||
computed: {
|
computed: {
|
||||||
|
v: {
|
||||||
|
get() {
|
||||||
|
return this.value;
|
||||||
|
},
|
||||||
|
set(v) {
|
||||||
|
this.$emit('input', v);
|
||||||
|
}
|
||||||
|
},
|
||||||
filled(): boolean {
|
filled(): boolean {
|
||||||
return this.v != '' && this.v != null;
|
return this.v != '' && this.v != null;
|
||||||
}
|
}
|
||||||
},
|
},
|
||||||
watch: {
|
|
||||||
value(v) {
|
|
||||||
this.v = v;
|
|
||||||
}
|
|
||||||
},
|
|
||||||
mounted() {
|
mounted() {
|
||||||
if (this.$refs.prefix) {
|
if (this.$refs.prefix) {
|
||||||
this.$refs.label.style.left = (this.$refs.prefix.offsetLeft + this.$refs.prefix.offsetWidth) + 'px';
|
this.$refs.label.style.left = (this.$refs.prefix.offsetLeft + this.$refs.prefix.offsetWidth) + 'px';
|
||||||
|
Loading…
Reference in New Issue
Block a user