fix(runtime-dom): unref when setting useCssVars

This commit is contained in:
Evan You 2020-07-15 18:31:10 -04:00
parent 9b5ff2b567
commit 44e6da1402

View File

@ -5,7 +5,8 @@ import {
watchEffect,
warn,
VNode,
Fragment
Fragment,
unref
} from '@vue/runtime-core'
import { ShapeFlags } from '@vue/shared/src'
@ -45,7 +46,7 @@ function setVarsOnVNode(
if (vnode.shapeFlag & ShapeFlags.ELEMENT && vnode.el) {
const style = vnode.el.style
for (const key in vars) {
style.setProperty(`--${prefix}${key}`, vars[key])
style.setProperty(`--${prefix}${key}`, unref(vars[key]))
}
} else if (vnode.type === Fragment) {
;(vnode.children as VNode[]).forEach(c => setVarsOnVNode(c, vars, prefix))