zoom-image icon indicating copy to clipboard operation
zoom-image copied to clipboard

Cannot read property 'setAttribute' of null

Open hackuun opened this issue 8 years ago • 3 comments

Hello. I got that error when I try to destroy

beforeDestroy () {
    const destroyZoom = zoom(document.querySelector('img'))
    destroyZoom()
    console.log('destroyed')
  }

hackuun avatar Aug 18 '17 15:08 hackuun

why would you call zoom in beforeDestroy hook?

egoist avatar Aug 18 '17 16:08 egoist

@egoist I was hoping that destroing will help me with the issue with this library, that if you "forget" to close overlay and click Back button, overlay class stays on body.

Here to replicate:

  1. Go to http://endurable-thunder.surge.sh/#/ then go to Zoom Image page
  2. Open image by clicking on it.
  3. Then do nothing, just hit Back button. Voila - overlay doesn't destroys.

Any ideas how to fix it? Because this doesn't help either:

mounted() {
    this.destroyZoom = zoom(this.$refs.img)
  },
  beforeDestroy () {
    this.destroyZoom()
  }

hackuun avatar Aug 18 '17 16:08 hackuun

Any chance it can be fixed? Great plugin, but this issue holding me.

hackuun avatar Aug 31 '17 19:08 hackuun