-
-
Notifications
You must be signed in to change notification settings - Fork 33.7k
Named slot is getting inserted twice #2163
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
Thank you! Awesome support |
@yyx990803 Unfortunately it doesn't solve the duplicate insertion for the named slot when using it('slot compilation order with v-if', function () {
var vm = new Vue({
el: document.createElement('div'),
template:
'<test>' +
'<div slot="one">slot1</div>' +
'default content' +
'</test>',
components: {
test: {
template:
'<div>' +
'<slot v-if="true"></slot> ' +
'<slot v-else></slot> ' +
'<slot name="one"></slot>' +
'</div>',
replace: true
}
}
})
expect(vm.$el.textContent).toBe('default content slot1')
}) |
Why would you use it this way though? There should be only one default slot. |
I changed the test case to yours but it passes for me. |
Hmm, I'll double check if I've got the right commit in the morning. About the use case, here's a simple example: <template>
<div v-show="isVisible" :class="sidebarClass">
<!-- Scrollable -->
<div v-if="scrollable" v-scrollable="scrollable">
<slot></slot>
</div>
<!-- Non Scrollable -->
<slot v-else></slot>
<slot name="root"></slot>
</div>
</template> The idea on this sample is when |
Doesn't the |
Yeah, now I see what you mean. It was confusing with just |
Sorry for the delay. I had the right commit, but I forgot to build it so of course in my project where I was importing Vue and testing, I was using the dist from the 1.0.14 release. So it's all good. Thanks! |
In the following example, slot1 is getting inserted twice. Is this normal?
Any idea why it's behaving like this?
https://jsfiddle.net/6tc2wzne/
The text was updated successfully, but these errors were encountered: