fix(Image): memory leak during SSR (#6721)

This commit is contained in:
chenjiahan 2020-07-07 15:06:48 +08:00
parent 4c87fe2479
commit 62e0012952

View File

@ -1,4 +1,4 @@
import { createNamespace, isDef, addUnit } from '../utils'; import { createNamespace, isDef, addUnit, inBrowser } from '../utils';
import Icon from '../icon'; import Icon from '../icon';
const [createComponent, bem] = createNamespace('image'); const [createComponent, bem] = createNamespace('image');
@ -71,7 +71,7 @@ export default createComponent({
created() { created() {
const { $Lazyload } = this; const { $Lazyload } = this;
if ($Lazyload) { if ($Lazyload && inBrowser) {
$Lazyload.$on('loaded', this.onLazyLoaded); $Lazyload.$on('loaded', this.onLazyLoaded);
$Lazyload.$on('error', this.onLazyLoadError); $Lazyload.$on('error', this.onLazyLoadError);
} }