Skip to content
This repository was archived by the owner on Mar 7, 2025. It is now read-only.

Commit 0cd1201

Browse files
kidonngegoist
authored andcommitted
fix(saber-plugin-image): fix lazy load for images with srcset (#264)
* feat(saber-plugin-image): add an option to disable `srcset` * fix: fix `srcset` lazy load * docs: revert changes
1 parent 265f4cc commit 0cd1201

File tree

1 file changed

+3
-3
lines changed

1 file changed

+3
-3
lines changed

packages/saber-plugin-image/lib/saber-browser.js

Lines changed: 3 additions & 3 deletions
Original file line numberDiff line numberDiff line change
@@ -3,7 +3,7 @@ import styles from './styles.module.css'
33

44
export default ({ Vue }) => {
55
const options = Object.assign(
6-
(process.browser && __SABER_IMAGE_OPTIONS__) || {}, // eslint-disable-line no-undef
6+
__SABER_IMAGE_OPTIONS__ || {}, // eslint-disable-line no-undef
77
{ lazyComponent: true }
88
)
99

@@ -40,7 +40,7 @@ export default ({ Vue }) => {
4040
})
4141
}
4242

43-
const { width, height, src, srcSet: srcset, placeholder } = this.src
43+
const { width, height, src, srcSet, placeholder } = this.src
4444

4545
const loading =
4646
(getOption('placeholder') && placeholder) ||
@@ -52,7 +52,7 @@ export default ({ Vue }) => {
5252
return h('img', {
5353
attrs: {
5454
...$attrs,
55-
srcset,
55+
'data-srcset': srcSet,
5656
width,
5757
height
5858
},

0 commit comments

Comments
 (0)