转自https://blog.csdn.net/qq_39115469/article/details/113795097

 

const app   = createApp(App);

 app.config.globalProperties.$axios = axios;

之后在引入的地方 import { getCurrentInstance }  from 'vue';

const { proxy } = getCurrentInstance();

onMounted(() => {

  log(proxy.$axios)

})