hilongjw / vue-lazyload

A Vue.js plugin for lazyload your Image or Component in your application.
http://hilongjw.github.io/vue-lazyload/
MIT License
8.01k stars 868 forks source link

how to set error image #162

Open Jesonhu opened 7 years ago

Jesonhu commented 7 years ago

i use like this 1 main.js中配置

import Vue from 'vue'
import VueLazyload from 'vue-lazyload' // 懒加载
Vue.use(VueLazyload, {
  preLoad: 1.3,
  error: 'http://hilongjw.github.io/vue-lazyload/dist/404.png',
  loading: './assets/loading-spin.svg',
  attempt: 1,
  listenEvents: [ 'scroll' ],
  adapter: {
    loaded (listener, fromCache, Init) {
    },
    loading (listener, Init) {
      console.log('Lazy loading')
    },
    error (listener, Init) {
      console.log('Lazy error')
    }
  }
})

2 具体使用懒加载的页面

<img class="img"
           v-lazy="item.listPic"
           :alt="item.name">

某个src图片加载失败后显示

<img data-v-28336d0f="" alt="11乐在棋中——校园棋艺大赛" class="img" src="data:image/gif;base64,R0lGODlhAQABAIAAAAAAAP///yH5BAEAAAAALAAAAAABAAEAAAIBRAA7" lazy="error">

我怎么修改让自定义的错误图片显示出来呢?

hilongjw commented 7 years ago

What version are you currently using?

Jesonhu commented 7 years ago

vue-lazyload: 1.0.5

vue: 2.3.3

pc: window 10 专业版64位

sprabowo commented 6 years ago

i have the same issue. when src is not found, error handle image cant show

zyp-zhang commented 5 years ago

请问你解决了吗 我也遇到了这样的问题

demyan1411 commented 4 years ago

same issue!