搜尋

首頁  >  問答  >  主體

javascript - vue 懶加載插件 圖片不更新

使用了這兩個外掛程式
lazy-load-img
vue-lazy-load-img
當有新資料替換掉原有的goodsList後,懶載入的圖片不變,不知道怎麼處理

<p v-for="item in goodsList">
    <vue-lazy-load-img 
        mode="diy" 
        :time="50" 
        :complete="true" 
        :position="{ top: 0, right: 0, bottom: 0, left: 0 }" 
        :diy="{ backgroundSize: 'cover', backgroundRepeat: 'no-repeat', backgroundPosition: 'center center' }"
        @before="before" 
        @success="success" 
        @error="error">
        <img 
            :src="'../image/load-img.png'" 
            :src="item.thumb_img">
    </vue-lazy-load-img>
</p>
                        
<script src="../script/lazy-load-img.js"></script>
<script src="../script/vue-lazy-load-img.js"></script>

data: {
    goodsList: []
}
phpcn_u1582phpcn_u15822817 天前697

全部回覆(2)我來回復

  • 给我你的怀抱

    给我你的怀抱2017-06-12 09:22:53

    這個組件嘛沒用過,建議你去issues提問,https://github.com/lzxb/vue-l...

    回覆
    0
  • phpcn_u1582

    phpcn_u15822017-06-12 09:22:53

    我在專案中也用到了圖片懶加載,不過不是這個組件,你可以參考我用的這個組件,不會有你這種情況的發生。
    項目中的圖片懶加載

    回覆
    0
  • 取消回覆