import { createApp } from 'vue' import App from './App.vue' import router from './router' import store from './store' import api from "./api/http"; const app = createApp(App); app.config.globalProperties.$api = api; app.use(store).use(router).mount('#app')
使用
this.$api.get('/api') .then(res=> { console.log(res) if(res.code == 0){ this.list = res.data } }) .catch(error=>{ console.log(error) })