Migrated InputText to Vue 3

pull/496/head
Cagatay Civici 2020-09-12 23:57:21 +03:00
parent 9431e0486c
commit d42ba43e32
1 changed files with 8 additions and 9 deletions

View File

@ -1,21 +1,20 @@
<template> <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> </template>
<script> <script>
export default { export default {
props: { props: {
value: null modelValue: null
},
methods: {
onInput(event) {
this.$emit('update:modelValue', event.target.value);
}
}, },
computed: { computed: {
listeners() {
return {
...this.$listeners,
input: event => this.$emit('input', event.target.value)
};
},
filled() { filled() {
return (this.value != null && this.value.toString().length > 0) return (this.modelValue != null && this.modelValue.toString().length > 0)
} }
} }
} }