Skip to content

Commit

Permalink
fix(runtime-dom): unref when setting useCssVars
Browse files Browse the repository at this point in the history
  • Loading branch information
yyx990803 committed Jul 15, 2020
1 parent 9b5ff2b commit 44e6da1
Showing 1 changed file with 3 additions and 2 deletions.
5 changes: 3 additions & 2 deletions packages/runtime-dom/src/helpers/useCssVars.ts
Original file line number Diff line number Diff line change
Expand Up @@ -5,7 +5,8 @@ import {
watchEffect,
warn,
VNode,
Fragment
Fragment,
unref
} from '@vue/runtime-core'
import { ShapeFlags } from '@vue/shared/src'

Expand Down Expand Up @@ -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))
Expand Down

0 comments on commit 44e6da1

Please sign in to comment.