Skip to content

Commit 96cdad5

Browse files
committed
fix(374): remove unnecessary img reload
1 parent c5d1ffd commit 96cdad5

File tree

4 files changed

+12
-7
lines changed

4 files changed

+12
-7
lines changed

package.json

Lines changed: 1 addition & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -1,6 +1,6 @@
11
{
22
"name": "vue-lazyload",
3-
"version": "3.0.0-rc.1",
3+
"version": "3.0.0-rc.2",
44
"description": "Vue module for lazy-loading images in your vue.js applications.",
55
"main": "vue-lazyload.js",
66
"module": "vue-lazyload.esm.js",

src/lazy.ts

Lines changed: 4 additions & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -215,7 +215,10 @@ class Lazy {
215215

216216
const exist = this.ListenerQueue.find(item => item.el === el)
217217
if (!exist) {
218-
this.add(el, binding, vnode!)
218+
// https://github.com/hilongjw/vue-lazyload/issues/374
219+
if (el.getAttribute('lazy') !== 'loaded' || el.dataset.src !== src) {
220+
this.add(el, binding, vnode!)
221+
}
219222
} else {
220223
exist.update({
221224
src,

vue-lazyload.esm.js

Lines changed: 5 additions & 3 deletions
Original file line numberDiff line numberDiff line change
@@ -1,5 +1,5 @@
11
/*!
2-
* Vue-Lazyload.js v3.0.0-alpha.0
2+
* Vue-Lazyload.js v3.0.0-rc.1
33
* (c) 2022 Awe <hilongjw@gmail.com>
44
* Released under the MIT License.
55
*/
@@ -535,7 +535,7 @@ const DEFAULT_OBSERVER_OPTIONS = {
535535
};
536536
class Lazy {
537537
constructor({ preLoad, error, throttleWait, preLoadTop, dispatchEvent, loading, attempt, silent = true, scale, listenEvents, filter, adapter, observer, observerOptions }) {
538-
this.version = '"3.0.0-alpha.0"';
538+
this.version = '"3.0.0-rc.1"';
539539
this.lazyContainerMananger = null;
540540
this.mode = modeType.event;
541541
this.ListenerQueue = [];
@@ -633,7 +633,9 @@ class Lazy {
633633
src = getBestSelectionFromSrcset(el, this.options.scale) || src;
634634
const exist = this.ListenerQueue.find(item => item.el === el);
635635
if (!exist) {
636-
this.add(el, binding, vnode);
636+
if (el.getAttribute('lazy') !== 'loaded' || el.dataset.src !== src) {
637+
this.add(el, binding, vnode);
638+
}
637639
} else {
638640
exist.update({
639641
src,

vue-lazyload.js

Lines changed: 2 additions & 2 deletions
Some generated files are not rendered by default. Learn more about customizing how changed files appear on GitHub.

0 commit comments

Comments
 (0)