inside my input component, I have this code in order to make the v-model on the input works as a component:
computed: {
inputListeners: function() {
const vm = this;
return Object.assign({},
this.$listeners,
{
input: (event: any) => {
vm.$emit('input', event.target.value);
},
},
);
},
This is the official example: https://v2.vuejs.org/v2/guide/components-custom-events.html#Binding-Native-Events-to-Components
Now Typescript return me this Warning:
WARNING in /Users/../components/InputText.vue
Expected method shorthand in object literal ('{inputListeners() {...}}').
> inputListeners: function() {
Do you know the code solution?
Use method shorthand format: inputListeners() { ... }
computed: {
inputListeners() {
...
}
}
If you love us? You can donate to us via Paypal or buy me a coffee so we can maintain and grow! Thank you!
Donate Us With