父组件
import {provide} from 'vue'
const role = ref<string>('')
provide('roleKey',{ role })
--------------------------------------
子组件或者下面的孙子重孙重重孙们组件
import {inject} from 'vue'
const { role } = inject<any>('roleKey')
父组件
import {provide} from 'vue'
const role = ref<string>('')
provide('roleKey',{ role })
--------------------------------------
子组件或者下面的孙子重孙重重孙们组件
import {inject} from 'vue'
const { role } = inject<any>('roleKey')