1.main.js
import { createApp} from 'vue'
import App from './App.vue'
import router from './router'
import store from './store'
import ElementPlus from 'element-plus'
import 'element-plus/dist/index.css'
import axios from 'axios'
const app = createApp(App);
app.config.globalProperties.$axios = axios
app.use(store).use(ElementPlus).use(router).mount('#app');
2.使用
go(){
var _this = this
this.$axios({
method: 'post',
url: '/api/xxx/xxx/xxxx.do',
params: {
start: "0",
pageSize: "10",
}
}).then(function (response) {
_this.msg = response.data.message;
})
.catch(function (error) {
console.log(error);
});
}
网友评论