Home

Issue: 1015

hooks for external libraries

[issue link]

Hi I am using v1.0.0-alpha.4

Let’s say we can use below syntax to implement an external library

head: {
  script: [
    { src: '/example.js' } // this file is in static
  ]
}

I wanna use this library in special page, for instance in About Page, so I can put this snippet in layouts/about.vue or page/about.vue (actually both had been tried)

The scenario is:

  1. If I enter the About Page directly through http://domain/about, all works well
  2. If I enter the About Page from Index Page through <nuxt-link to="/about">, I can not use the exposed function from example.js, because the js file didn’t download yet when mounted was invoked, I also tried window.onload which the function inside won’t be invoked.

So is there a hook existent which will be invoked after external libraries finish download?

This question is available on Nuxt.js community (#c886)