I created a dashboard with a search button. When I input data into the search box, I want that data to be sent to my backend URL path so I can call my backend API. Can someone assist me in figuring out how to pass the v-model data to my URL path?
Dashboard.vue
<template>
<div class="main">
<div class="navbar navbar-default navbar-fixed-top">
<div class="navbar-header">
<img src="../assets/education.png" alt="notFound" class="education-image" />
</div>
<ul class="nav navbar-nav">
<li>
<p class="brand">Bookstore</p>
</li>
</ul>
<div class="input-group">
<i @click="handlesubmit();" class="fas fa-search"></i>
<div class="form-outline">
<input type="search" v-model="name" class="form-control" placeholder='search...' />
</div>
</div>
</div>
</div>
</template>
<script>
import service from '../service/User'
export default {
data() {
return {
name:'',
}
},
methods:{
handlesubmit(){
let userData = {
name:this.name,
}
service.userSearchByName(userData).then(response=>{
this.books.push(...response.data);
})
}
}
}
</script>
user.js
userSearchByName(data){
return axios.getData(`/searchBooksbyName/${}`,data);
}