fix(sfc/style-vars): should attach css vars while subtree changed (#2178)
* fix(cssVars): should attach css vars while `subtree` changed fix #2177 * fix: fix test
This commit is contained in:
@@ -2,11 +2,12 @@ import {
|
||||
ComponentPublicInstance,
|
||||
getCurrentInstance,
|
||||
onMounted,
|
||||
watchEffect,
|
||||
warn,
|
||||
VNode,
|
||||
Fragment,
|
||||
unref
|
||||
unref,
|
||||
onUpdated,
|
||||
watchEffect
|
||||
} from '@vue/runtime-core'
|
||||
import { ShapeFlags } from '@vue/shared'
|
||||
|
||||
@@ -27,11 +28,10 @@ export function useCssVars(
|
||||
? `${instance.type.__scopeId.replace(/^data-v-/, '')}-`
|
||||
: ``
|
||||
|
||||
onMounted(() => {
|
||||
watchEffect(() => {
|
||||
setVarsOnVNode(instance.subTree, getter(instance.proxy!), prefix)
|
||||
})
|
||||
})
|
||||
const setVars = () =>
|
||||
setVarsOnVNode(instance.subTree, getter(instance.proxy!), prefix)
|
||||
onMounted(() => watchEffect(setVars))
|
||||
onUpdated(setVars)
|
||||
}
|
||||
|
||||
function setVarsOnVNode(
|
||||
|
||||
Reference in New Issue
Block a user