Skip to content

Instantly share code, notes, and snippets.

@Mosquid
Created November 12, 2020 14:58
Show Gist options
  • Star 0 You must be signed in to star a gist
  • Fork 0 You must be signed in to fork a gist
  • Save Mosquid/3eabc324380646e5667773aadcc613de to your computer and use it in GitHub Desktop.
Save Mosquid/3eabc324380646e5667773aadcc613de to your computer and use it in GitHub Desktop.
gearbest parse product images
{
...
getProductImages: function () {
try {
const imageNodes = document.querySelectorAll(
"#js-goodsIntroThumbNail img"
)
const images = []
imageNodes.forEach((img) => {
images.push(`${img.dataset.originSrc}_600x600.jpg`)
})
return images
} catch (error) {
console.error(error)
return []
}
}
}
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment