是否可以将router-link绑定到b卡的image属性,即 不存在,我想切换图片点击链接
<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>
有没有不手动创建'img'标签的解决方案?
答案 0 :(得分:1)
这是我找到的最佳解决方案
<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>