}
},
actions: {
// 封装一个 ajax 方法
getUserInfo(context) {
axios({
method: ‘post’,
url: ‘/user’,
data: context.state.test02
})
}
}
})
export default store
注意:即使已经在 main.js 中引入了 axios,并改写了原型链,也无法在 store.js 中直接使用 $ajax 命令
2.App.vue
}
},
actions: {
// 封装一个 ajax 方法
getUserInfo(context) {
axios({
method: ‘post’,
url: ‘/user’,
data: context.state.test02
})
}
}
})
export default store
注意:即使已经在 main.js 中引入了 axios,并改写了原型链,也无法在 store.js 中直接使用 $ajax 命令
2.App.vue