main.js文件
const app = createApp(App)
//进行全局配置
app.config.globalProperties.msg= 'hello'
组件文件
<script>
import { getCurrentInstance } from 'vue'
export default {
setup(){
const { proxy } = getCurrentInstance()
console.log(proxy.msg) //hello
}
}
</script>
希望对大家有所帮助,哈哈哈...