2.6.10
https://github.com/tbutcaru/v-issue-multiple-dynamic-slot-names
npm install
npm run serve
Multiple dynamic slot names should work as expected.
The following error is thrown:
Invalid dynamic argument expression: attribute names cannot contain spaces, quotes, <, >, / or =.#[headerslot]>Header slot</template>
Default slot
<template #[footerslot]
If one of the dynamic slot names is made static (doesn't matter which), the application is working.
node_modules/vue-template-compiler/build.js
attrs.forEach(function (attr) {
) added the following warn: warn$1('--------------->> ' + attr.name);
#[headerslot]
#[headerslot]>Header slot</template>
Default slot
<template #[footerslot]
So, it looks like the compiler doesn't know how to extract just the attribute when there are multiple dynamic slot names.
The shorthand is only available when an argument is provided. Try to use:
<template v-slot:[dynamicSlotName]>
...
</template>
The shorthand is only available when an argument is provided. Try to use:
<template v-slot:[dynamicSlotName]> ... </template>
I've tried that before creating the issue and the result is the same 😞
Hi everyone!
What new about this ? I still have the problem in 2.6.11 reproduce here
After many tries, I found a way to make multi dynamic slots work. When i add keys to root element of the dynamics slot templates, it fall in work:
this doesn't work: reproduce here
<template #[slot1]>
<p>slot test</p>
</template>
<template #[slot2]>
<p>slot test2</p>
</template>
// got "Invalid dynamic argument expression: attribute names cannot contain spaces, quotes, <, >, / or ="
this work: reproduce here
<template #[slot1]>
<p key="1">slot test</p>
</template>
<template #[slot2]>
<p key="2">slot test2</p>
</template>
// work fine
Why i need to add keys to make it work? I missed something.
@davis90 's solution worked for me. I don't get why it works too.
Why are the errors so misleading in vue. Thanks though your solution worked
Most helpful comment
After many tries, I found a way to make multi dynamic slots work. When i add keys to root element of the dynamics slot templates, it fall in work:
this doesn't work: reproduce here
this work: reproduce here
Why i need to add keys to make it work? I missed something.