Just getting started with vue js, so please forgive me if this is a silly question.
I'm attempting to create a search input while pulling JSON data from a URL using Axios.
Here's my code:
<div id="app">
<div class="search-wrapper">
<label>
<input type="text" v-model="search" placeholder="Search title.."/>
Search here:
</label>
</div>
<div class="wrapper">
<li v-for="name in this.names " :key="name">
{{ name }}
</li>
</div>
</div>
And the JavaScript section:
import axios from 'axios'
export default {
data() {
return {
search: 'john',
names: [],
}
},
mounted() {
axios
.get('http://127.0.0.1/users/search/' + this.search)
.then((response) => {this.names = response.data})
},
}
Everything is functioning fine up till now, but when I change the name in the search input, nothing happens. Any assistance would be greatly appreciated.