store下面的index.js
state: {
param1: true,
},
mutations: {
function1(state,val){
state.params1 = val
}
},
actions: {
function1(context) {
context.commit('function1')
}
}
某Vue文件
axios({
method: 'GET',
url:`........`,
params:{},
}).then(({data}) => {
console.log("返回数据",data),
let resData = data
if(resData == ''){
this.$store.commit('function1',参数)
}
})