Image:fix loading="lazy" lazyLoad not work

pull/22879/head
shay-an 2024-05-15 13:35:40 +08:00
parent c345bb453b
commit 899d72159b
1 changed files with 4 additions and 3 deletions

View File

@ -70,7 +70,7 @@
return {
loading: true,
error: false,
show: !this.lazy,
show: !(this.lazy || this.$attrs.loading === 'lazy'),
imageWidth: 0,
imageHeight: 0,
showViewer: false
@ -120,7 +120,8 @@
},
mounted() {
if (this.lazy) {
// fix https://github.com/ElemeFE/element/issues/22873
if (this.lazy || this.$attrs.loading === 'lazy') {
this.addLazyLoadListener();
} else {
this.loadImage();
@ -128,7 +129,7 @@
},
beforeDestroy() {
this.lazy && this.removeLazyLoadListener();
(this.lazy || this.$attrs.loading === 'lazy') && this.removeLazyLoadListener();
},
methods: {