Answer the question
In order to leave comments, you need to log in
Adding attributes dynamically?
I'm trying to do something like this:
there is a variable isLink
, it is either true
either false
depending on the value of the variable, you need to render <div class="link">контент</div>
either
<router-link to="/path" class="link">контент</router-link>
<component :is="isLink ? 'router-link' : 'div'" to="/path">
<div class="link" to="/path">контент</div>
Answer the question
In order to leave comments, you need to log in
Why not do so?
<router-link to="/path" class="link" v-if"isLink">контент</router-link>
<div class="link" to="/path" v-else>контент</div>
Didn't find what you were looking for?
Ask your questionAsk a Question
731 491 924 answers to any question