vue-lazyload
vue-lazyload copied to clipboard
Backround image null loading
Hi. Here is my template:
<div v-lazy:background-image="(isSpecial ? image.url : null)">
<div>title</div>
<img v-lazy="(false === isSpecial ? image.url : null)">
</div>
And config:
Vue.use(VueLazyload, {
preLoad: 1.3,
error: '/images/lazy-error.png',
loading: '/images/lazy-loading.png',
attempt: 1,
filter: {
webp(listener, options) {
if (!options.supportWebp || !listener.src || /\.webp$/.test(listener.src)) {
return;
}
listener.src += '.webp';
},
},
});
When isSpecial === false I expected no background-image in root div, but get lazy-error.png.
How i can solve it?
const loadImageAsync = (item, resolve, reject) => {
let image = new Image()
if (!item || !item.src) {
const err = new Error('image src is required')
return reject(err)
}
}
It would be nice to have some empty value (like 'none') that doesn't trigger error, and don't append image. It also would be nice for loading/error images.