I have a line_items array, iterated using v-for. For each of the line_item object, I need a v-autocomplete element that is used to search for category.
Currently, I'm using the search-input.sync="searchText" to do sync search as the user types into the text input box. This works well if there is a single line_item object, but if there are 2 or more, the searchText change affects all other line_items too.
Example code:
<div v-for="line_item in line_items">
<v-autocomplete
:items=""categories
:search-input.sync="searchText"
placeholder="Select category"
></v-autocomplete>
</div>
And I'm using the watch method from the composition API to watch for changes in searchText like so:
const searchText = ref(null)
watch(searchText, query => fetchCategories(query))
How do I go about correcting this problem? If possible, I'd really like to keep the .sync behavior so that the search function fires off whenever user inputs something. TIA!