Reputation: 463
Is it possible to bind router-link to b-card's image attribute which are not physically exists,i want to switching link on image click
<b-col lg="3" v-for="product in products" v-bind:key="product.id">
<b-card
v-bind:title="product.title"
v-bind:img-src="product.img"
v-bind:img-alt="product.alt"
img-top
tag="article"
style="max-width: 20rem;"
class="mb-2">
<b-card-text>Some quick example text to build on the card title and
make up the bulk of the card's content.</b-card-text>
</b-card>
</b-col>
Is there any solutions without creating 'img' tag manually?
Upvotes: 4
Views: 1558
Reputation: 463
Here is best solution i found
<b-card no-body
v-bind:title="product.title"
v-bind:img-alt="product.alt"
img-top
tag="article"
style="max-width: 20rem;"
class="mb-2"
>
<router-link :to="/someurl">
<b-card-img :src="product.img"/>
</router-link>
<b-card-body>
<b-card-title>CCCCCCCCc</b-card-title>
<b-card-text>Some quick example text to build on the card title and make up
the
bulk of the card's content.</b-card-text>
</b-card-body>
</b-card>
</b-col>
Upvotes: 4