fix(runtime-dom): unref when setting useCssVars
This commit is contained in:
parent
9b5ff2b567
commit
44e6da1402
@ -5,7 +5,8 @@ import {
|
|||||||
watchEffect,
|
watchEffect,
|
||||||
warn,
|
warn,
|
||||||
VNode,
|
VNode,
|
||||||
Fragment
|
Fragment,
|
||||||
|
unref
|
||||||
} from '@vue/runtime-core'
|
} from '@vue/runtime-core'
|
||||||
import { ShapeFlags } from '@vue/shared/src'
|
import { ShapeFlags } from '@vue/shared/src'
|
||||||
|
|
||||||
@ -45,7 +46,7 @@ function setVarsOnVNode(
|
|||||||
if (vnode.shapeFlag & ShapeFlags.ELEMENT && vnode.el) {
|
if (vnode.shapeFlag & ShapeFlags.ELEMENT && vnode.el) {
|
||||||
const style = vnode.el.style
|
const style = vnode.el.style
|
||||||
for (const key in vars) {
|
for (const key in vars) {
|
||||||
style.setProperty(`--${prefix}${key}`, vars[key])
|
style.setProperty(`--${prefix}${key}`, unref(vars[key]))
|
||||||
}
|
}
|
||||||
} else if (vnode.type === Fragment) {
|
} else if (vnode.type === Fragment) {
|
||||||
;(vnode.children as VNode[]).forEach(c => setVarsOnVNode(c, vars, prefix))
|
;(vnode.children as VNode[]).forEach(c => setVarsOnVNode(c, vars, prefix))
|
||||||
|
Loading…
Reference in New Issue
Block a user