Skip to content

在globalProperties上挂载的响应式属性,在template中必须使用.value获取 #7405

Discussion options

You must be logged in to vote

If you want to auto unref, I suggest use:

https://vueuse.org/shared/resolveUnref/

import { resolveUnref } from '@vueuse/core'

const foo = ref('hi')

const a = resolveUnref(0) // 0
const b = resolveUnref(foo) // 'hi'
const c = resolveUnref(() => 'hi') // 'hi'

Or

...
const app = createApp(App)
app.config.globalProperties = reactive({ msg: ref('hello') })
...

let the globalProperties is a Reactivity value.

Replies: 1 comment 3 replies

Comment options

You must be logged in to vote
3 replies
@anchogin
Comment options

@liulinboyi
Comment options

@anchogin
Comment options

Answer selected by anchogin
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment
Labels
None yet
2 participants