Nuxt custom routing configuration

nuxtAutomatic generation of routing very easy
but the habit of project development for each file vue New Folder, configure my css in it and so
you need to manually configure the routing
in nuxt.config.jsthe configuration router

  router: {
    
    
    extendRoutes(routes, resolve) {
    
    
      routes.push({
    
    
        path: '/',
        name: 'index',
        component: resolve(__dirname, 'pages/index/index.vue')
      }, {
    
    
        path: '/main',
        name: 'main',
        component: resolve(__dirname, 'pages/main/main.vue')
      }, {
    
    
        path: '/detail',
        name: 'detail',
        component: resolve(__dirname, 'pages/detail/detail.vue')
      })
    }
  },

Insert picture description here

Guess you like

Origin blog.csdn.net/AK852369/article/details/112780055