Skip to content
New issue

Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.

By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.

Already on GitHub? Sign in to your account

Cannt view image if img element has loading="lazy" attribute #403

Closed
Roamin opened this issue Aug 5, 2020 · 2 comments
Closed

Cannt view image if img element has loading="lazy" attribute #403

Roamin opened this issue Aug 5, 2020 · 2 comments

Comments

@Roamin
Copy link

Roamin commented Aug 5, 2020

Describe the bug
Cannt view image if img element has loading="lazy" attribute

To Reproduce

<div
		class="c-image-viewer"
		ref="viewer"
	>
		<img
			class="c-image-viewer__image"
			loading="lazy"
			v-for="(src, index) in images"
			:src="src.thumbnail"
			:data-src="src.source"
			:key="src.source"
			@click="handleViewImage(index)"
		/>
	</div>
methods: {
	handleViewImage(index) {
		if (!this.viewer) {
			this.viewer = new Viewer(this.$refs.viewer, {
				url(image) {
					return image.src
				},
			})
		}

		this.viewer.view(index)
	},
},

Expected behavior
should be
image

Screenshots
but
image

If I remove loading="lazy" attribute, everything goes well

Desktop (please complete the following information):

  • MacOS
  • Browser Chrome
  • Version 84.0.4147.105
@fengyuanchen
Copy link
Owner

fengyuanchen commented Aug 9, 2020

Just remove the loading attribute from the inheritedAttributes option.

@jeff-wangzhen
Copy link

jeff-wangzhen commented Jan 1, 2023

Just remove the loading attribute from the inheritedAttributes option.

@fengyuanchen 只能这样了吗?是否有优化空间呢?

Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment
Labels
None yet
Projects
None yet
Development

No branches or pull requests

3 participants