Ambiguous combined usage of slot-scope and v-for on (v-for takes higher priority). Use a wrapper for the...
up vote
0
down vote
favorite
In my Nuxt.js application, I use Vuetify.js. Here is the piece of code that causes me trouble:
<v-list dense>
<v-hover>
<v-list-tile
v-for="menuItem in menuItems"
:key="menuItem.title"
slot-scope="{ hover }"
:class="`elevation-${hover ? 12 : 0}`">
<v-list-tile-action>
<v-icon> {{menuItem.icon }} </v-icon>
</v-list-tile-action>
<v-list-tile-content>
<v-list-tile-title>{{ menuItem.title }}</v-list-tile-title>
</v-list-tile-content>
</v-list-tile>
</v-hover>
</v-list>
That triggers this error message:
(Emitted value instead of an instance of Error) Ambiguous combined
usage of slot-scope and v-for on (v-for takes higher
priority). Use a wrapper for the scoped slot to make it
clearer.
The code works fine when I remove the v-hover
component.
I read the error message and I tried to do what it suggests:
<template
slot-scope="{ hover }"
:class="`elevation-${hover ? 12 : 0}`">
<!--
Wrap v-list-tile-action and v-list-tile-content code here
-->
</template>
But I faced other issues.
Any idea on how to fix it?
javascript vue.js vuetify.js
add a comment |
up vote
0
down vote
favorite
In my Nuxt.js application, I use Vuetify.js. Here is the piece of code that causes me trouble:
<v-list dense>
<v-hover>
<v-list-tile
v-for="menuItem in menuItems"
:key="menuItem.title"
slot-scope="{ hover }"
:class="`elevation-${hover ? 12 : 0}`">
<v-list-tile-action>
<v-icon> {{menuItem.icon }} </v-icon>
</v-list-tile-action>
<v-list-tile-content>
<v-list-tile-title>{{ menuItem.title }}</v-list-tile-title>
</v-list-tile-content>
</v-list-tile>
</v-hover>
</v-list>
That triggers this error message:
(Emitted value instead of an instance of Error) Ambiguous combined
usage of slot-scope and v-for on (v-for takes higher
priority). Use a wrapper for the scoped slot to make it
clearer.
The code works fine when I remove the v-hover
component.
I read the error message and I tried to do what it suggests:
<template
slot-scope="{ hover }"
:class="`elevation-${hover ? 12 : 0}`">
<!--
Wrap v-list-tile-action and v-list-tile-content code here
-->
</template>
But I faced other issues.
Any idea on how to fix it?
javascript vue.js vuetify.js
At hover should all tiles have same class or are you going to emphasise only the one currently hovered?
– barbsan
Nov 8 at 11:53
I presume you should putv-for
onv-hover
or wrap list inside thev-hover
.
– Traxo
Nov 8 at 12:22
1
@BillalBegueradj It seemed weird but I asked whether they all should share the same class
– barbsan
Nov 8 at 12:59
add a comment |
up vote
0
down vote
favorite
up vote
0
down vote
favorite
In my Nuxt.js application, I use Vuetify.js. Here is the piece of code that causes me trouble:
<v-list dense>
<v-hover>
<v-list-tile
v-for="menuItem in menuItems"
:key="menuItem.title"
slot-scope="{ hover }"
:class="`elevation-${hover ? 12 : 0}`">
<v-list-tile-action>
<v-icon> {{menuItem.icon }} </v-icon>
</v-list-tile-action>
<v-list-tile-content>
<v-list-tile-title>{{ menuItem.title }}</v-list-tile-title>
</v-list-tile-content>
</v-list-tile>
</v-hover>
</v-list>
That triggers this error message:
(Emitted value instead of an instance of Error) Ambiguous combined
usage of slot-scope and v-for on (v-for takes higher
priority). Use a wrapper for the scoped slot to make it
clearer.
The code works fine when I remove the v-hover
component.
I read the error message and I tried to do what it suggests:
<template
slot-scope="{ hover }"
:class="`elevation-${hover ? 12 : 0}`">
<!--
Wrap v-list-tile-action and v-list-tile-content code here
-->
</template>
But I faced other issues.
Any idea on how to fix it?
javascript vue.js vuetify.js
In my Nuxt.js application, I use Vuetify.js. Here is the piece of code that causes me trouble:
<v-list dense>
<v-hover>
<v-list-tile
v-for="menuItem in menuItems"
:key="menuItem.title"
slot-scope="{ hover }"
:class="`elevation-${hover ? 12 : 0}`">
<v-list-tile-action>
<v-icon> {{menuItem.icon }} </v-icon>
</v-list-tile-action>
<v-list-tile-content>
<v-list-tile-title>{{ menuItem.title }}</v-list-tile-title>
</v-list-tile-content>
</v-list-tile>
</v-hover>
</v-list>
That triggers this error message:
(Emitted value instead of an instance of Error) Ambiguous combined
usage of slot-scope and v-for on (v-for takes higher
priority). Use a wrapper for the scoped slot to make it
clearer.
The code works fine when I remove the v-hover
component.
I read the error message and I tried to do what it suggests:
<template
slot-scope="{ hover }"
:class="`elevation-${hover ? 12 : 0}`">
<!--
Wrap v-list-tile-action and v-list-tile-content code here
-->
</template>
But I faced other issues.
Any idea on how to fix it?
javascript vue.js vuetify.js
javascript vue.js vuetify.js
edited Nov 8 at 11:37
asked Nov 8 at 11:30
Billal Begueradj
5,511132637
5,511132637
At hover should all tiles have same class or are you going to emphasise only the one currently hovered?
– barbsan
Nov 8 at 11:53
I presume you should putv-for
onv-hover
or wrap list inside thev-hover
.
– Traxo
Nov 8 at 12:22
1
@BillalBegueradj It seemed weird but I asked whether they all should share the same class
– barbsan
Nov 8 at 12:59
add a comment |
At hover should all tiles have same class or are you going to emphasise only the one currently hovered?
– barbsan
Nov 8 at 11:53
I presume you should putv-for
onv-hover
or wrap list inside thev-hover
.
– Traxo
Nov 8 at 12:22
1
@BillalBegueradj It seemed weird but I asked whether they all should share the same class
– barbsan
Nov 8 at 12:59
At hover should all tiles have same class or are you going to emphasise only the one currently hovered?
– barbsan
Nov 8 at 11:53
At hover should all tiles have same class or are you going to emphasise only the one currently hovered?
– barbsan
Nov 8 at 11:53
I presume you should put
v-for
on v-hover
or wrap list inside the v-hover
.– Traxo
Nov 8 at 12:22
I presume you should put
v-for
on v-hover
or wrap list inside the v-hover
.– Traxo
Nov 8 at 12:22
1
1
@BillalBegueradj It seemed weird but I asked whether they all should share the same class
– barbsan
Nov 8 at 12:59
@BillalBegueradj It seemed weird but I asked whether they all should share the same class
– barbsan
Nov 8 at 12:59
add a comment |
1 Answer
1
active
oldest
votes
up vote
1
down vote
accepted
Try moving v-for
from v-list-tile
to v-hover
(demo):
<v-list dense>
<v-hover v-for="menuItem in menuItems">
<v-list-tile
:key="menuItem.title"
slot-scope="{ hover }"
:class="`elevation-${hover ? 12 : 0}`">
<!-- your content -->
</v-list-tile>
</v-hover>
</v-list>
add a comment |
1 Answer
1
active
oldest
votes
1 Answer
1
active
oldest
votes
active
oldest
votes
active
oldest
votes
up vote
1
down vote
accepted
Try moving v-for
from v-list-tile
to v-hover
(demo):
<v-list dense>
<v-hover v-for="menuItem in menuItems">
<v-list-tile
:key="menuItem.title"
slot-scope="{ hover }"
:class="`elevation-${hover ? 12 : 0}`">
<!-- your content -->
</v-list-tile>
</v-hover>
</v-list>
add a comment |
up vote
1
down vote
accepted
Try moving v-for
from v-list-tile
to v-hover
(demo):
<v-list dense>
<v-hover v-for="menuItem in menuItems">
<v-list-tile
:key="menuItem.title"
slot-scope="{ hover }"
:class="`elevation-${hover ? 12 : 0}`">
<!-- your content -->
</v-list-tile>
</v-hover>
</v-list>
add a comment |
up vote
1
down vote
accepted
up vote
1
down vote
accepted
Try moving v-for
from v-list-tile
to v-hover
(demo):
<v-list dense>
<v-hover v-for="menuItem in menuItems">
<v-list-tile
:key="menuItem.title"
slot-scope="{ hover }"
:class="`elevation-${hover ? 12 : 0}`">
<!-- your content -->
</v-list-tile>
</v-hover>
</v-list>
Try moving v-for
from v-list-tile
to v-hover
(demo):
<v-list dense>
<v-hover v-for="menuItem in menuItems">
<v-list-tile
:key="menuItem.title"
slot-scope="{ hover }"
:class="`elevation-${hover ? 12 : 0}`">
<!-- your content -->
</v-list-tile>
</v-hover>
</v-list>
edited Nov 8 at 13:22
answered Nov 8 at 13:13
barbsan
2,106521
2,106521
add a comment |
add a comment |
Sign up or log in
StackExchange.ready(function () {
StackExchange.helpers.onClickDraftSave('#login-link');
});
Sign up using Google
Sign up using Facebook
Sign up using Email and Password
Post as a guest
Required, but never shown
StackExchange.ready(
function () {
StackExchange.openid.initPostLogin('.new-post-login', 'https%3a%2f%2fstackoverflow.com%2fquestions%2f53206874%2fambiguous-combined-usage-of-slot-scope-and-v-for-on-v-for-takes-higher-priority%23new-answer', 'question_page');
}
);
Post as a guest
Required, but never shown
Sign up or log in
StackExchange.ready(function () {
StackExchange.helpers.onClickDraftSave('#login-link');
});
Sign up using Google
Sign up using Facebook
Sign up using Email and Password
Post as a guest
Required, but never shown
Sign up or log in
StackExchange.ready(function () {
StackExchange.helpers.onClickDraftSave('#login-link');
});
Sign up using Google
Sign up using Facebook
Sign up using Email and Password
Post as a guest
Required, but never shown
Sign up or log in
StackExchange.ready(function () {
StackExchange.helpers.onClickDraftSave('#login-link');
});
Sign up using Google
Sign up using Facebook
Sign up using Email and Password
Sign up using Google
Sign up using Facebook
Sign up using Email and Password
Post as a guest
Required, but never shown
Required, but never shown
Required, but never shown
Required, but never shown
Required, but never shown
Required, but never shown
Required, but never shown
Required, but never shown
Required, but never shown
At hover should all tiles have same class or are you going to emphasise only the one currently hovered?
– barbsan
Nov 8 at 11:53
I presume you should put
v-for
onv-hover
or wrap list inside thev-hover
.– Traxo
Nov 8 at 12:22
1
@BillalBegueradj It seemed weird but I asked whether they all should share the same class
– barbsan
Nov 8 at 12:59