1. 在接口函数中定义(api/index.js):(切记一定是没有{},否则就参数错误啦)
// export const reqShopList=({geohash,keyword})=>ajax(base_url+'/search_shops',{geohash, keyword})
export const reqShopList=(geohash,keyword)=>ajax(base_url+'/search_shops',{geohash, keyword})
2.在mutation-type里定义:
export const RECEIVE_SEARCH_SHOPS='receive_search_shops'//接收搜索的商家数组
3. 在mutation里:
[RECEIVE_SEARCH_SHOPS](state, {
searchshops
}) {
state.searchshops = searchshops;
},
4. 在action里:(接收参数)
async searchShopGoods({
commit
,state},keyword) {
const geohash = state.latitude + ',' + state.longitude;
const re