import Vue from "vue";
import VueRouter from "vue-router";
import HomePage from "@/pages/HomePage.vue";
import PortfolioPage from "@/pages/PortfolioPage.vue";
import SampleCollectionPage from "@/pages/SampleCollectionPage.vue";
Vue.use(VueRouter);

const routes = [
  {
    path: "/",
    name: "HomePage",
    component: HomePage,
    meta: { direction: "back" },
  },
  {
    path: "/portfolio",
    name: "PortfolioPage",
    component: PortfolioPage,
    meta: { direction: "forward" },
  },
  {
    path: "/sampleCollection",
    name: "SampleCollectionPage",
    component: SampleCollectionPage,
    meta: { direction: "forward" },
  },
];

const router = new VueRouter({
  mode: "history",
  routes,
});

// 全局前置守卫
router.beforeEach((to, from, next) => {
  next();
});

export default router;
