Nuxt 中路由拦截

1,810 阅读1分钟

1.plugins文件中创建router.js 文件

export default ({ app, store, $axios }) => {
    app.router.beforeEach((to, from, next) => {
        next()
    })
}

2.nuxt.config.js配置文件中引入改plugins

plugins: [
    { src: '@/plugins/router.js', ssr: false}
  ],