import Vue from 'vue'
import VueRouter from 'vue-router'

Vue.use(VueRouter)

const routes = [
  {
    path: '/www/',
    name: 'home',
    component: () => import('../views/home.vue')
  },
  {
    path: '/www/page/:id',
    name: 'page',
    component: () => import('../views/page.vue'),
    props: true
  },
  {
    path: '/www/list/:id',
    name: 'list',
    component: () => import('../views/list.vue'),
    props: true
  },
  {
    path: '/www/details/:id',
    name: 'details',
    component: () => import('../views/details.vue'),
    props: true
  }
]

const router = new VueRouter({
  mode: 'history',
  // base: process.env.BASE_URL,
  routes
})
router.beforeEach((to, from, next) => {
  if (to.path !== '/') {
    if (to.path === from.path) return
  }
  next()
})
export default router
