【问题标题】:How to show an image inside a VueJs v-for [duplicate]如何在 VueJs v-for [重复] 中显示图像
【发布时间】:2019-09-13 00:07:04
【问题描述】:

如何在 VueJs 循环中显示图像?

我确实使用:<img src="/store/{{store.image}}">

我尝试在 v-for 循环中显示图像,但这种情况会显示以下错误消息:

属性内的插值已被删除。 请改用 v-bind 或冒号简写。 例如,不要使用<div id="{{ val }}">,,而是使用<div :id="val">

这是我的 v-for:

  <slide v-for="store in stores" :key="store.id" :store="store">                    
        <div class="rows is_block "> 
              <vue-flip active-click=1 class="is-block">
                <div slot="front">
                  <img src="/store/{{store.image}}">

【问题讨论】:

    标签: vuejs2


    【解决方案1】:

    动态道具是使用冒号创建的:

    &lt;img :src="'/store/'+store.image"&gt;

    查看Template SyntaxShorthands 的文档

    【讨论】:

    • 谢谢@Slim,我尝试了,您的解决方案效果很好!
    猜你喜欢
    • 2020-04-22
    • 1970-01-01
    • 2018-04-27
    • 2019-09-17
    • 2020-06-29
    • 2020-07-28
    • 1970-01-01
    • 2020-06-22
    • 1970-01-01
    相关资源
    最近更新 更多