I am attempting to develop a function that is activated by the @change
event on multiple input fields.
My goal is to set loading="true"
for the targeted input until the axios
request (PATCH) is completed.
PLEASE NOTE:
There are several v-select
components on the page, and I only want to set loading=true for the specific target - the current input/select.
EXAMPLE:
When a user selects an option in the first select in the following example, the inlineUpdate
function is triggered, which changes the target to appear like this
<v-select loading="true" @change="$root.inlineUpdate" ...
Subsequently, once the update
is completed, the loading
attribute is removed.
I believe I need to pass an event
argument into the method, but it is not functioning as expected.
Currently, only a value is passed, and it is unclear which input should be marked as loading.
<v-select @change="$root.inlineUpdate" ...
<v-select @change="$root.inlineUpdate" ...
<v-select @change="$root.inlineUpdate" ...
<v-text-field @change="$root.inlineUpdate"...
inlineUpdate(event){
console.log(event)
console.log(event.target)
# here I need to set loading="true" for the input
axios.post(...).finally(() => { // remove the loading })
# stop loading
},
console logs show:
>>> house
>>> undefined
Is there a solution to this issue?