clarketm/image-map

How to use in Nuxt.js app.

Closed this issue · 2 comments

I want to use image-map plugin in Nuxt.js app.

So I make sample app
https://github.com/dokechin/nuxt-imagemap-example

In the case, image-map page visit second time from nuxt-link.
It not going successfully. (http://localhost:3000/)

In the case image-map page visited at first.
It going successfully.(http://localhost:3000/index2)

How to execute former case?

@dokechin - this does not appear to be an issue with ImageMap but rather an issue in implementation. I am not a Vue user personally, but I did observe, after looking at the Vue lifecycle diagram, that if you replace mounted with created in index.vue then it works as expected.

updated works equally as well, albeit which lifecycle hook you use should be based off your specific needs. I would expect that you want to re-initialize ImageMap on DOM updates.

e.g.

-  mounted() {
+  created() {
    $('img[usemap]').imageMap()
  }

Very very thanks you, I can do!!