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

const router = createRouter({
  history: createWebHistory(import.meta.env.BASE_URL),
  routes: [
    {
      path: "/",
      name: "blog",
      component: () => import("@/views/blog/blog.vue"),
      children: [
        {
          path: "/",
          name: "show",
          component: () => import("@/views/blog/show.vue"),
        },
        {
          path: "/viewDetails",
          name: "viewDetails",
          component: () => import("@/views/blog/viewDetails.vue"),
        },
        {
          path: "/myplayer",
          name: "myplayer",
          component: () => import("@/views/blog/myplayer.vue"),
        },
        {
          path: "/me",
          name: "me",
          component: () => import("@/views/blog/me.vue"),
        },
        {
          path: "/articles",
          name: "articles",
          component: () => import("@/views/blog/articles.vue"),
        }
      ],
    },
    {
      path: "/admin",
      name: "admin",
      component: () => import("@/views/admin/admin.vue"),

      children: [
        {
          path: "posts",
          name: "posts",
          meta: {
            title: "文章管理",
          },
          component: () => import("@/views/admin/article.vue"),
        },
        {
          path: "news",
          name: "news",
          component: () => import("@/views/admin/news.vue"),
          meta: {
            title: "新闻管理",
          },
        },
        {
          path: "comments",
          name: "comments",
          component: () => import("@/views/admin/comments.vue"),
        },
      ],
    },
  ],
});

export default router;
