vue.js 全局地址设置
vue.js 全局地址设置
vue2
// main.js Vue.prototype.$xxxx = xxx //通过 this.$xxx来获取挂载
vue3
// main.js
const app = createApp(App);
app.config.globalProperties.$xxx = xxx;
// xx.vue
import { getCurrentInstance } from 'vue';
const { proxy } = getCurrentInstance();
let xx = proxy.$xxx