1import axios from 'axios';
2
3// Provide style
4const app = Vue.createApp(App);
5app.provide('$axios', axios);
6
7// Composition style
8const { inject } = Vue;
9setup() {
10 const $axios = inject('$axios');
11}
12
13// Options style
14inject: ['$axios'],
15
16// setup global axios
17import axios from 'axios';
18
19const app = Vue.createApp(App);
20app.config.globalProperties.$axios = axios;
21
22// access this axios
23this.$axios