-
-
Notifications
You must be signed in to change notification settings - Fork 8.6k
style v-bind will be invalid in teleport #4605
New issue
Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.
By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.
Already on GitHub? Sign in to your account
Comments
@edison1105 Yesterday, I wrote the same code as you to solve this issue, but when I delete the child of the Then I found that the export function useCssVars(getter: (ctx: any) => Record<string, string>) {
if (!__BROWSER__ && !__TEST__) return
const instance = getCurrentInstance()
/* istanbul ignore next */
if (!instance) {
__DEV__ &&
warn(`useCssVars is called without current active component instance.`)
return
}
const setVars = () =>
setVarsOnVNode(instance.subTree, getter(instance.proxy!))
watchPostEffect(setVars)
onMounted(() => {
const ob = new MutationObserver(setVars)
// In this case, the `instance.subTree.el!.parentNode` is equal to the DOM of `#app`
ob.observe(instance.subTree.el!.parentNode, { childList: true })
onUnmounted(() => ob.disconnect())
})
} |
@WJCHumble Good catch. |
I have also run into this issue. It took me a while to realize it's actually caused by teleport. Because sometimes you use a slot of either your or a third-party component and you don't know what exactly will happen to the content you're passing in. There can be teleport used inside and then you are wondering why For example, Vue could detect a teleport somewhere down the component tree from where |
same problem |
Any updades on this? :( |
Same problem |
fix vuejs#4605 close vuejs#4609 (used tests from this PR)
fix vuejs#4605 close vuejs#4609 (used tests from this PR)
Version
3.2.9
Reproduction link
sfc.vuejs.org/
Steps to reproduce
use v-bind in <style>
add the class to the child of teleport
What is expected?
style is valid
What is actually happening?
style is invalid
The text was updated successfully, but these errors were encountered: