Error using multiple dynamic slot names (Invalid dynamic argument expression)
See original GitHub issueVersion
2.6.10
Reproduction link
https://github.com/tbutcaru/v-issue-multiple-dynamic-slot-names
Steps to reproduce
- Clone this repo: https://github.com/tbutcaru/v-issue-multiple-dynamic-slot-names
- Run:
npm install
- Run:
npm run serve
What is expected?
Multiple dynamic slot names should work as expected.
What is actually happening?
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.
My investigation
- file:
node_modules/vue-template-compiler/build.js
- line: 2563 (inside
attrs.forEach(function (attr) {
) added the following warn:
warn$1('--------------->> ' + attr.name);
Investigation results:
- In the working scenario with only one dynamic slot name: the value of that dynamic slot name is
#[headerslot]
- In the error scenario with two dynamic slot names: the value of the first dynamic slot name is
#[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.
Issue Analytics
- State:
- Created 4 years ago
- Reactions:5
- Comments:10 (1 by maintainers)
Top Results From Across the Web
Multiple dynamic named slots - Get Help
I'm having some issues using multiple dynamic slots. ... Errors compiling template: Invalid dynamic argument expression: attribute names ...
Read more >Vue and Bootstrap Vue - dynamically use slots
Because Vue supports Dynamic Slot Names, you can use variables to set the slot names using the v-bind:[attributeName]="value" syntax.
Read more >Tips to Supercharge Your Slots (Named, Scoped, and ...
If one slot is great, then multiple slots are better, right? With named slots we can create multiple slots in a component, and...
Read more >Database Engine events and errors - SQL Server
Consult this MSSQL error code list to find explanations for error messages for SQL Server database engine events.
Read more >Phoenix.Component — Phoenix LiveView v0.18.3
For dynamic values, you can interpolate Elixir expressions into a function component: <.greet name={@user.name} />. Function components can also accept ...
Read more >Top Related Medium Post
No results found
Top Related StackOverflow Question
No results found
Troubleshoot Live Code
Lightrun enables developers to add logs, metrics and snapshots to live code - no restarts or redeploys required.
Start FreeTop Related Reddit Thread
No results found
Top Related Hackernoon Post
No results found
Top Related Tweet
No results found
Top Related Dev.to Post
No results found
Top Related Hashnode Post
No results found
Top GitHub Comments
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.
Hey all, I am using vue 2.6.10, I got same problem, after google something I found this way to fix it.
the main idea is add ‘=“”’ after [], remember only last one can keep without =“”, for short just add =“” for all v-slot
good luck for everyone.
btw VUE is good.
a online demo based on @Justineo demo code