说明: get和post方式是封装在axios.js里面的.目录里common.js同级
//common.js文件
import Vue from 'vue'
import Vuex from 'vuex'
import axios from 'axios'
export default{
login:function(){
this.axios.get("", {})
.then(res => {
let { msg, code, data } = res.data;
if (code !== 1) {
this.$message({
message: msg,
type: "error"
});
} else {
console.log(res);
}
})
.catch(function(error) {
console.log(error);
});
}
}
//InstitutionSetup.vue 文件
mounted() {
this.common.login()
}