scrollBehavior()

in nuxt.config.js [19:39]


    scrollBehavior(to) {
      if (to.hash) {
        const id = to.hash.substr(1)
        const el =
          document.getElementById(decodeURIComponent(id)) ||
          document.getElementById(id)

        if (el) {
          el.scrollIntoView &&
            el.scrollIntoView({
              behavior: 'smooth'
            })
        }
      } else {
        document.getElementsByClassName('page-main')[0].scrollTo({
          top: 0,
          left: 0,
          behavior: 'smooth'
        })
      }
    }