-
-
Notifications
You must be signed in to change notification settings - Fork 8.9k
Closed
Labels
🔨 p3-minor-bugPriority 3: this fixes a bug, but is an edge case that only affects very specific usage.Priority 3: this fixes a bug, but is an edge case that only affects very specific usage.scope: sfcscope: sfc-style-vars
Description
Version
3.1.0-beta.7
Reproduction link
https://codesandbox.io/s/vue3-style-vars-2-issue-v-if-style-vars-binding-inside-transition-4qtf1
Steps to reproduce
Create the following component:
<template>
<transition>
<div v-if="isDisplayed" class="bloc"></div>
</transition>
</template>
<script>
import { ref } from "vue"
export default {
setup() {
const isDisplayed = ref(false)
const color = "#8BA7AF"
setTimeout(() => isDisplayed.value = true, 1000)
return {
isDisplayed,
color
}
}
}
</script>
<style scoped>
.bloc {
width: 100px;
height: 100px;
background-color: v-bind(color);
}
</style>
The transition content will be displayed one second after the component was created.
What is expected?
The HTML node (transition child) should contain the style variables.
What is actually happening?
The HTML node (transition child) doesn't contain the style variables so the component is not well displayed.
It doesn't work either with OptionAPI, neither with CompositionAPI.
DOM inspection:
<div id="app" data-v-app="">
<div class="bloc" data-v-149ffcac="" style="--149ffcac-color:#9F8BAF;"> [OptionAPI] not deferred</div>
<div class="bloc" data-v-885362c0="" style="--885362c0-color:#8BA7AF;"> [CompositionAPI] not deferred</div>
<div class="bloc" data-v-149ffcac=""> [OptionAPI] deferred</div>
<div class="bloc" data-v-885362c0=""> [CompositionAPI] deferred</div>
</div>
Metadata
Metadata
Assignees
Labels
🔨 p3-minor-bugPriority 3: this fixes a bug, but is an edge case that only affects very specific usage.Priority 3: this fixes a bug, but is an edge case that only affects very specific usage.scope: sfcscope: sfc-style-vars