mirror of https://github.com/ElemeFE/element
Image:fix loading="lazy" lazyLoad not work
parent
c345bb453b
commit
899d72159b
|
@ -70,7 +70,7 @@
|
||||||
return {
|
return {
|
||||||
loading: true,
|
loading: true,
|
||||||
error: false,
|
error: false,
|
||||||
show: !this.lazy,
|
show: !(this.lazy || this.$attrs.loading === 'lazy'),
|
||||||
imageWidth: 0,
|
imageWidth: 0,
|
||||||
imageHeight: 0,
|
imageHeight: 0,
|
||||||
showViewer: false
|
showViewer: false
|
||||||
|
@ -120,7 +120,8 @@
|
||||||
},
|
},
|
||||||
|
|
||||||
mounted() {
|
mounted() {
|
||||||
if (this.lazy) {
|
// fix https://github.com/ElemeFE/element/issues/22873
|
||||||
|
if (this.lazy || this.$attrs.loading === 'lazy') {
|
||||||
this.addLazyLoadListener();
|
this.addLazyLoadListener();
|
||||||
} else {
|
} else {
|
||||||
this.loadImage();
|
this.loadImage();
|
||||||
|
@ -128,7 +129,7 @@
|
||||||
},
|
},
|
||||||
|
|
||||||
beforeDestroy() {
|
beforeDestroy() {
|
||||||
this.lazy && this.removeLazyLoadListener();
|
(this.lazy || this.$attrs.loading === 'lazy') && this.removeLazyLoadListener();
|
||||||
},
|
},
|
||||||
|
|
||||||
methods: {
|
methods: {
|
||||||
|
|
Loading…
Reference in New Issue