0

nuxt.config.js

import colors from 'vuetify/es5/util/colors'

export default {
  // Global page headers: https://go.nuxtjs.dev/config-head
  ssr: false,
  loadingIndicator: {
    name: '~/preloader2.html'
  },

  router: {
    middleware: "delay"
  },

delay.js

export default ({isServer }) => {
  // Don't use the middleware on server-side
  if (isServer) return
  // Return a promise to tell nuxt.js to wait for the end of it
  return new Promise((resolve) => {
    // Wait 1500 ms between each route
    setTimeout(resolve, 1500);
  })
}

Now when I want to go to an ID in the HTML, I have to wait for 1500ms like in delay.js.
How can I do that the delay is just functioning for the preloader and not for all other things like ->

<li><a class="nlink" @click="goto()">HOME</a></li>
<nuxt-link :to="{ path: '',hash:'#model'}" class="nlink"> MODEL </nuxt-link>
...
....

goto() {
  this.$router.replace({name: this.$route.name, hash: '#model'});
}
kissu
  • 40,416
  • 14
  • 65
  • 133

0 Answers0