Thursday, May 9, 2024
 Popular · Latest · Hot · Upcoming
102
rated 0 times [  107] [ 5]  / answers: 1 / hits: 17877  / 6 Years ago, fri, november 9, 2018, 12:00:00

I am trying to change the class to apply on a Vuetify.js component based on whether there is a mouse hover or not:



<v-card
class=mx-auto
width=344
>
<v-hover>
<v-card-title
slot-scope=hover
:class=`${hover? class1: class2}`>
<div>
<span class=headline>Hover</span>
</div>
</div>

</v-card-title>
</v-hover>
</v-card>


The CSS classes simply set the background-color property:



.class1 {
background-color:red;
}

.class2 {
background-color:blue;
}


For some reason, this is not working. What am I missing?



Codepen.


More From » vuetify.js

 Answers
66

You miss quotes in your prop class binding and curly braces in your slot-scope prop.



It should be defined like this :



slot-scope={ hover }
:class=`${hover? 'class1': 'class2'}`>





Working CodePen



Vuetify Hover Doc


[#53141] Tuesday, November 6, 2018, 6 Years  [reply] [flag answer]
Only authorized users can answer the question. Please sign in first, or register a free account.
wilson

Total Points: 27
Total Questions: 93
Total Answers: 93

Location: Tajikistan
Member since Sun, Aug 29, 2021
3 Years ago
wilson questions
Tue, Aug 9, 22, 00:00, 2 Years ago
Wed, May 11, 22, 00:00, 2 Years ago
Wed, May 20, 20, 00:00, 4 Years ago
Wed, May 13, 20, 00:00, 4 Years ago
;