import { ref, getCurrentInstance } from 'vue';
const instance = getCurrentInstance();
const myGlobalVar = ref(instance.appContext.config.globalProperties.$myGlobalVar);
console.log(myGlobalVar.value); // 输出 "Hello, world!"
记一下
import { ref, getCurrentInstance } from 'vue';
const instance = getCurrentInstance();
const myGlobalVar = ref(instance.appContext.config.globalProperties.$myGlobalVar);
console.log(myGlobalVar.value); // 输出 "Hello, world!"
记一下