Привязка маршрутизатора к изображению b-карты - PullRequest
0 голосов
/ 08 мая 2019

Возможно ли привязать роутер-ссылку к атрибуту изображения b-карты, которые физически не существует, я хочу переключить ссылку на изображение нажмите

 <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' вручную?

1 Ответ

1 голос
/ 08 мая 2019

Вот лучшее решение, которое я нашел

<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>
...