routes.js 2.87 KB
// const pages = {
//   coupon: [{
//     name: 'index',
//     meta: {
//       isTab: true
//     }
//   },
//   {
//     name: 'verificationList',
//     meta: {
//       title: '核销列表',
//       keepAlive: true
//     }
//   },
//   {
//     name: 'verificationDetail',
//     meta: {
//       title: '核销详情',
//       keepAlive: true
//     }
//   },
//   {
//     name: 'goodsVerification',
//     meta: {
//       title: '核销订单',
//       keepAlive: true
//     }
//   }
//   ],
//   activity: [
//     {
//       name: 'index',
//       meta: {
//         isTab: true,
//         keepAlive: true,
//         backgroundColor: '#F7F7F7'
//       },
//     }
//   ],
//   merchant: [
//     {
//       name: 'index',
//       meta: {
//         keepAlive: true,
//         isIndex: true,
//         backgroundColor: '#F7F7F7',
//         title: '店铺中心'
//       }
//     }
//   ],
//   gift:[
//     {
//       name:'index',
//       meta: {
//         title:'定向礼包',
//         backgroundColor: '#F7F7F7'
//       }
//     },
//     {
//       name:'detail',
//       meta: {
//         title:'定向礼包',
//         backgroundColor: '#F7F7F7'
//       }
//     },
//     {
//       name:'create',
//       meta: {
//         title:'定向礼包',
//         backgroundColor: '#F7F7F7'
//       }
//     }
//   ]
// }
const routes = [
  // {
  //   path:'/',
  //   redirect: '/coupon'
  // }
  // 登录
  {
    path: '/index',
    name: 'index',
    meta: 'layout',
    // redirect: {
    //   name: 'index'
    // },
    // component: import('@/views/layouts/index')
    component: () => import('@/views/layouts')
  },
  {
    path: '/tipsPage',
    name: 'tipsPage',
    meta: {
      title: '提示'
    },
    // redirect: {
    //   name: 'index'
    // },
    // component: import('@/views/layouts/index')
    component: () => import('@/views/tipsPage')
  },
  {
    // path: '/ailpay',
    path: '/',
    redirect: { name: 'index' },
    // name: 'index',
    component: () => import('@/views/layouts'),
    children: [
      {
        // 支付页面
        path: '/alipay',
        name: 'alipay',
        meta: {
          title: '支付宝支付'
        },
        component: () => import('@/views/alipay')
      }
    ]
  }
]
// const keepAlives = []
// Object.keys(pages).map(parent => {
//   pages[parent].map(val => {
//     let childrenPath = `${parent}/${val.name}`
//     let { meta } = val
//     const path = `/${val.name == 'index' ? parent : childrenPath}`
//     const name = val.name == 'index' ? parent : childrenPath.replace('/', '.')
//     if (meta && meta.keepAlive) keepAlives.push(name)
//     let route = {
//       component: resolve => require([`views/${childrenPath}.vue`], resolve),
//       path,
//       name,
//       meta
//     }
//     routes.push(route)
//   })
// })
// console.log(routes)
// export const keeps = keepAlives
export default routes