Migrated InputText to Vue 3
parent
9431e0486c
commit
d42ba43e32
|
@ -1,21 +1,20 @@
|
|||
<template>
|
||||
<input :class="['p-inputtext p-component', {'p-filled': filled}]" v-on="listeners" :value="value" />
|
||||
<input :class="['p-inputtext p-component', {'p-filled': filled}]" :value="modelValue" @input="onInput" />
|
||||
</template>
|
||||
|
||||
<script>
|
||||
export default {
|
||||
props: {
|
||||
value: null
|
||||
modelValue: null
|
||||
},
|
||||
methods: {
|
||||
onInput(event) {
|
||||
this.$emit('update:modelValue', event.target.value);
|
||||
}
|
||||
},
|
||||
computed: {
|
||||
listeners() {
|
||||
return {
|
||||
...this.$listeners,
|
||||
input: event => this.$emit('input', event.target.value)
|
||||
};
|
||||
},
|
||||
filled() {
|
||||
return (this.value != null && this.value.toString().length > 0)
|
||||
return (this.modelValue != null && this.modelValue.toString().length > 0)
|
||||
}
|
||||
}
|
||||
}
|
||||
|
|
Loading…
Reference in New Issue