
import { createRouter, createWebHistory } from 'vue-router'
import { defineAsyncComponent } from 'vue'

// import Home from '@/views/Home.vue'
// import HomeView from '@/views/HomeView.vue'
//路由异步加载
//主页框架
const Home = () => import('@/views/Home.vue')

//首页详细内容
const HomeView = () => import('@/views/HomeView.vue')

// 组件异步懒加载方法
// const _import = (path: string) =>
//   defineAsyncComponent(() => import(`../views/${path}.vue`))
const routes = [
  {
    path: '/home',
    name: 'home',
    // component: Home,
    component: Home,
    redirect: "/home/homeView",
    children: [{
      path: 'homeView',
      name: 'homeView',
      component: HomeView
      // component: _import('HomeView')
    }]
    // component: HomeView
  },

]
const router = createRouter({
  history: createWebHistory(import.meta.env.BASE_URL),
  routes
})

export default router
