Я попытался включить функции поиска в nuxtjs, но у меня возникла проблема, когда я отправляю форму поиска с тем же запросом, приложение не может снова запустить функцию searchResult.
header.vue
methods:{
submit(){
var t = this.$nuxt._router.push({path : '/search', query:{qs : this.querysearch}});
}
}
search.vue
methods:{
async SearchResult(){
var app = this ,
params = app.$nuxt._route.params,
query = app.$nuxt._route.query
var form = new FormData()
form.set('qs',query.qs);
let res = await app.$axios({
method : 'post',
url : 'http://localhost:8000/api/v1/item/search?page=1',
data : form,
headers : {
'Content-Type' : 'multipart/form-data'
}
})
this.datas = res.data.data.data
},
},
watch : {
'$route'(to,from){
this.SearchResult()
}
},
mounted(){
this.SearchResult();
},