Vue3全局绑定——config.globalProperties
作者:互联网
import { createApp } from 'vue'
import App from './App.vue'
//对于axios,和自己定义的工具不能像vue-router一样用app.use(),而要通过app.config.globalProperties = moduleName, example:
import Axios from 'axios'
const app = createApp(App)
app.config.globalProperties.Axios = Axios
//然后再其他组件中通过this.Axios使用
app.mount('#app')
标签:Axios,app,vue,Vue3,import,globalProperties,config 来源: https://www.cnblogs.com/Lilc20201212/p/15957732.html