一、vuex
1.actions方法调用
this.$store.dispatch("login", this.$store.state.loginUserInfo).then((res) => {
if (res) {
console.log(res);
}
});
2.mutations使用
this.$store.commit("login", loginUserInfo);
二、uniapp
1.调用api
uni.request({
url:'', //请求的地址,类型为String
data:'', //要求为Object或String类型的参数,发送到服务器的数据。如果已经不是字符串,将自动转换为字符串格式。get请求中将附加在url后
method:'', //get、post、delete
header:{}, //请求头的信息
success:res=>{}, //请求成功回调,带参数
fail:()=>{}, //请求失败
complete:=>{} //要求为Function类型的参数,请求完成后调用的回调函数(请求成功或失败时均调用)
})