I'm inquiring about watches and refs. The situation is that I have a vswitch with a v-model
where the setter action takes quite a bit of time to complete (involving writes to the store and numerous updates on the DOM).
An issue arises when Vue executes the action before rendering the new value of the switch. Ideally, I would like to display the input value immediately as it changes. My workaround involves "watching" the switch's inputValue and triggering the setter action when the value is changed.
My question revolves around implementing this functionality using TypeScript and vue-property-decorator
. To tackle this problem, I added a ref to my switch element and attempted the following approach:
@Watch("$refs.switch.inputValue", {
immediate: true,
deep: true,
})
change() {
alert('value changed');
}
I am wondering if it is possible to achieve this behavior using the @watch
decorator in Vue?