vue使用v-for渲染列表属性需要:="items.attribute"绑定

来源:互联网 发布:unity3d瀑布 编辑:程序博客网 时间:2024/06/13 05:49

- src="{{items.img}}": Interpolation inside attributes has been removed.
 Use v-bind or the colon shorthand instead. For example, 
 instead of <div id="{{ val }}">, use <div :id="val">.


绑定img的src属性,一开始的写法:
<li class="zlb_list_item" v-for="items in list">    <div class="zlb_list_img">        <img src="{{items.img}}" alt=""/>    </div>    <div class="zlb_list_title">        <p class="zlb_list_title_level">{{items.level}}</p>        <p class="zlb_list_title_date">{{items.date}}</p>    </div>    <div class="zlb_list_detail">{{items.price}}</div></li>

报错:
根据提示,改成:
<img :src="items.img" alt=""/>
错误排除