import {createRouter, createWebHashHistory} from "vue-router";

const routes = [
  {
    path: '/',
    redirect: '/home'
  },
  {
    path: '/home',
    name: "home",
    component: () => import('../pages/home/index.vue'),
    meta: {
      title: '',
      keepAlive: true
    }
  },
  {
    path: '/serviceplatform',
    name: "serviceplatform",
    component: () => import('../pages/serviceplatform/index.vue'),
    meta: {
      title: '',
      keepAlive: true
    }
  },
  {
    path: '/servicelist',
    name: "servicelist",
    component: () => import('../pages/servicelist/index.vue')
  },
  {
    path: '/guide',
    name: "guide",
    component: () => import('../pages/guide/index.vue')
  },
]
const router = createRouter({
  history: createWebHashHistory(),
  routes
})


router.beforeEach(async (to, from, next) => {
  if (to.meta.title) {
    document.title = to.meta.title as string
  }
  next()
})

export default router