声明
在main.js中
import Api from './api/config'
const app = createApp(App);
app.config.globalProperties.$Api = Api;
app.use(store).use(router).use(vant).use(Api).mount('#app');
代码中使用
this.$Api.get({
...
}).then((response) => { //请求成功返回的数据
...
}
}).catch((error) => {
...
})
记录vue3.0 踩坑日记