【问题标题】:Vuetify Nuxt.js : how to add url link in image tagVuetify Nuxt.js:如何在图像标签中添加 url 链接
【发布时间】:2021-01-12 13:37:54
【问题描述】:

我是 Nuxt.js 和 Vuetfiy 的新手,我想在图像标签中添加 url 链接。如果我按图片它应该打开其他页面链接

我的页面布局

我已经指定了网址,每张图片都有不同的网址,就像我想将此网址添加到图片中一样

to="/AppMain/Support/Support" 
and
 to="/UserDash/Profile" 
also
 to="/AppMain/Entertainment"
 how to add this urls in image

我的代码

    <template>
      <v-layout style="width: auto;" class="ma-auto">
        <v-carousel cycle light height="309" hide-delimiter-background show-arrows-on-hover>
          <v-carousel-item v-for="(slide, i) in slides" :key="i">
            <v-row>
              <v-col cols="3" v-for="(images, j) in slide.images" :key="j">
                <div class="d-flex flex-column justify-center align-center">
                  <v-img :src="images.src" width="30"/>
                  <span class="mx-auto text-center caption">{{ images.caption }}</span>
                </div>
              </v-col>
            </v-row>
          </v-carousel-item>
        </v-carousel>
      </v-layout>
    </template>
    
    <script>
    export default {
      name: "playground",
      data: () => ({
        slides: [
          {
            images: [
              { src: "https://akam.cdn.jdmagicbox.com/images/icontent/newwap/newprotmore/hkm_allcategories.svg", caption: "All Categories"},
              { src: "https://akam.cdn.jdmagicbox.com/images/icontent/newwap/newprotmore/hkm_b2b.svg", caption: "B2B" },
              { src: "https://akam.cdn.jdmagicbox.com/images/icontent/newwap/newprotmore/hkm_shopping.svg", caption: "Shopping" }
              
            ]
          },

【问题讨论】:

    标签: vue.js vuejs2 vue-component nuxt.js vuetify.js


    【解决方案1】:

    把它包起来:

    使用&lt;nuxt-link /&gt;:

    <nuxt-link to="#">
      <v-img :src="images.src" width="30"/>
    </nuxt-link>
    

    如果将 url 添加到 slide.images 数组中,则可以动态分配它们:

    <nuxt-link :to="images.url">
    

    【讨论】:

    • 你能回答我关于nuxt.js图片上传的另一个问题吗?请回复
    • @user12380208 问题的网址是什么?
    • 感谢您在这个问题中回复我的问题 url stackoverflow.com/questions/64182413/… 我没有添加图像文件输入以便更好地理解我的问题。谢谢
    猜你喜欢
    • 2021-01-13
    • 2020-07-25
    • 2020-06-06
    • 2017-06-16
    • 1970-01-01
    • 1970-01-01
    • 1970-01-01
    • 2021-03-22
    • 1970-01-01
    相关资源
    最近更新 更多