Open
Description
Version
11.0.0
Reproduction link
https://github.com/RuneInBoots/vue-issue
Steps to reproduce
We tried to use scoped CSS in our components.
In our application we also make use of slots.
We came across the problem that the elements in the slots were only following the parent scope.
We know this because we inspected the element and saw only one data-v-[id]
, and because our styles weren't applied =]
After searching we found out that our issue lied with the <transition>
around our child component.
// childComponent.vue
<template lang="html">
<!-- <transition> -->
<section>
<h1>Child component</h1>
<h2>text inside child</h2>
<p>child sets background to gold</p>
<h2>text from parent with slot</h2>
<slot name="foobar"></slot>
</section>
<!-- </transition> -->
</template>
<style lang="css" scoped>
p {background-color: gold;}
</style>
// parentComponent.vue
<template lang="html">
<section>
<h1>parent component</h1>
<h2>text inside parent</h2>
<p>parent sets color to crimson</p>
<child-component>
<p slot="foobar"> text from inside parent trough slot</p>
</child-component>
</section>
</section>
</template>
<script>
import childComponent from 'components/childComponent.vue';
export default {
components: {childComponent}
}
</script>
<style lang="css" scoped>
p {color: crimson;}
</style>
What is expected?
the text "text from inside parent trough slot" should have the color crimson and background-color gold. It should follow both the parent and the child scope.
What is actually happening?
the text only get the color crimson. it doesn't follow the CSS of the child scope.