import Vue from 'vue'
import VueRouter from 'vue-router'
import HomeView from '../views/HomeView.vue'
import TopUpView from '../views/TopUpView.vue'
import DownloadView from '../views/DownloadView.vue'

Vue.use(VueRouter)

const routes = [
  {
    path: '/',
    name: 'home',
    component: HomeView,
    meta: {
      // 路由元信息
      title: "home",
      keepAlive: true,
    },
  },
  {
    path: '/register',
    name: 'Create',
    component: HomeView,
    meta: {
      // 路由元信息
      title: "register",
      keepAlive: true,
    },
  },
  {
    path: '/topUp',
    name: 'TopUpView',
    // route level code-splitting
    // this generates a separate chunk (about.[hash].js) for this route
    // which is lazy-loaded when the route is visited.
    component: TopUpView,
    meta: {
      // 路由元信息
      title: "topUp",
      keepAlive: true,
    },
  },
  {
    path: '/download',
    name: 'DownloadView',
    component: DownloadView,
    meta: {
      // 路由元信息
      title: "download",
      keepAlive: true,
    },
  }
]

const router = new VueRouter({
  mode: 'history',
  base: process.env.BASE_URL,
  routes
})

export default router
