import {createRouter, createWebHistory} from 'vue-router' const router = createRouter({ history: createWebHistory(import.meta.env.BASE_URL), routes: [ { path: `/login`, name: 'login', component: () => import('../views/login/index.vue') }, /* { path: '/', name: 'null', redirect: {name: 'home'}, // component: () => import('../views/login/index.vue') },*/ { path: `/`, name: 'main', redirect: {name: 'buyProduct'}, component: () => import('../views/base/index.vue'), children: [ { path: 'home', name: 'home', component: () => import('../views/base/home/index.vue') }, { path: 'gold', name: 'gold', component: () => import('@/views/base/gold/index.vue') }, { path: 'buyProduct', name: 'buyProduct', component: () => import('@/views/base/products/index.vue') }, { path: 'product/:id', name: 'productDetail', component: () => import('@/views/base/products/product/[id].vue') }, { path: 'transactions', name: 'transactions', component: () => import('@/views/base/transactions/index.vue') }, { path: 'giftCard', name: 'giftCard', component: () => import('@/views/base/giftCard/index.vue') }, { path: 'wallet', name: 'wallet', component: () => import('../views/base/wallet/index.vue') }, { path: 'cart', name: 'cart', component: () => import('@/views/base/cart/index.vue') }, { path: 'user', name: 'user', component: () => import('../views/base/user/index.vue') }, { path: 'about', name: 'about', component: () => import('@/views/base/about/index.vue') }, { path: 'notifyTrigger', name: 'notifyTrigger', component: () => import('@/views/base/priceTrigger/index.vue') }, { path: 'appNotifications', name: 'appNotifications', component: () => import('@/views/base/appNotifications/index.vue') }, { path: 'transfer', name: 'transfer', component: () => import('@/views/base/transfer/index.vue') }, { path: 'address', name: 'address', component: () => import('@/views/base/address/index.vue') }, { path: 'physicalReceive', name: 'physicalReceive', redirect: { name: 'list' }, component: () => import('@/views/base/physicalReceive/index.vue'), children: [ { path: '', name: 'list', component: () => import('@/views/base/physicalReceive/components/RequestList.vue') }, { path: 'new', name: 'new', component: () => import('@/views/base/physicalReceive/components/NewRequest.vue') }, ] }, { path: 'rules', name: 'rules', component: () => import('@/views/base/rules/index.vue') }, { path: 'recoverySites', name: 'recoverySites', component: () => import('@/views/base/recoverySites/index.vue') }, { path: 'permissions', name: 'permissions', component: () => import('@/views/base/rules/permissions/permissions.vue') }, { path: 'earnMoney', name: 'earnMoney', component: () => import('@/views/base/earnMoney/index.vue') }, { path: 'fund', name: 'fund', component: () => import('@/views/base/fund/index.vue'), children: [] }, { path: 'fund/:id', name: 'fund_info', component: () => import('@/views/base/fund/info/index.vue') }, { path: 'fund/add', name: 'fund_add', component: () => import('@/views/base/fund/newFund/index.vue') }, ] }, { path: '/:pathMatch(.*)*', name: 'notFound', redirect: {name: '404'}, meta: { hideMenu: true } }, { path: `/404`, name: '404', component: () => import('../views/base/404.vue') }, /* { path: `/single/login`, name: 'login', component: () => import('../views/login/index.vue') }, { path: `/single/`, name: 'single_main', redirect: {name: 'login'}, component: () => import('../views/base/index.vue'), children: [ { path: 'home', name: 'home', component: () => import('../views/base/home/index.vue') }, { path: 'gold', name: 'gold', component: () => import('@/views/base/gold/index.vue') }, { path: 'transactions', name: 'transactions', component: () => import('@/views/base/transactions/index.vue') }, { path: 'wallet', name: 'wallet', component: () => import('../views/base/wallet/index.vue') }, { path: 'user', name: 'user', component: () => import('../views/base/user/index.vue') }, { path: 'fund', name: 'fund', component: () => import('@/views/base/fund/index.vue'), children: [] }, { path: 'fund/:id', name: 'fund_info', component: () => import('@/views/base/fund/info/index.vue') }, { path: 'fund/add', name: 'fund_add', component: () => import('@/views/base/fund/newFund/index.vue') }, ] },*/ ] }) router.afterEach((to, from) => { /* const toDepth = to.path.split('/').length const fromDepth = from.path.split('/').length to.meta.transition = toDepth < fromDepth ? 'slide-right' : 'slide-left'*/ /* if (to.name === 'home' && (from.name === 'wallet' || from.name === 'transactions' || from.name === 'gold')) { to.meta.transition = 'slide-left' } if (to.name === 'wallet' && (from.name === 'home' || from.name === 'transactions' || from.name === 'gold')) { to.meta.transition = 'slide-right' }*/ // console.log(to) }) export default router