functional requirements:
there is a search box on the home page and a search box on the list page. Enter the search content on the home page and jump to the search page to perform the search
nuxt implementation:
save the searchKeyWords field into vuex, on the home page, then go to the search page to get the searchKeyWords field, and perform a search
question:
after jumping from the home page to the search page, after the page is refreshed, the data in the searchKeyWords,store obtained through the context store turns out to be empty
async asyncData({ store, params }) {
let searchParams = {
keyword: store.state.searchKeyWords, //searchKeyWords
pageNo: 1,
pageSize: 10
}
let { result } = await API.searchMethod(searchParams);
return {
searchData:resul
}
}
but there is data in vuex