javascript - vue 懶加載插件 圖片不更新
phpcn_u1582
phpcn_u1582 2017-06-12 09:20:53
0
2
585

使用了這兩個外掛程式
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_u1582
phpcn_u1582

全部回覆(2)
给我你的怀抱

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

phpcn_u1582

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

熱門教學
更多>
最新下載
更多>
網站特效
網站源碼
網站素材
前端模板
關於我們 免責聲明 Sitemap
PHP中文網:公益線上PHP培訓,幫助PHP學習者快速成長!