import Vue from 'vue';
import Router from 'vue-router';
// import Home from './containers/Home.vue';
// import DatePicker from './containers/DatePicker.vue';
import SearchItem from './containers/SearchItem.vue';
import Pagination from './containers/Pagination.vue';
import Dialog from './containers/Dialog.vue';
import NormalDialog from './containers/NormalDialog.vue';
import Transfer from './containers/Transfer.vue';

import layoutIcon from '../src/assets/images/menu/home.png';

Vue.use(Router);

export const routerMap = [
  {
    path: '/',
    name: 'Home',
    component: () => import('./containers/Home.vue'),
    meta: { title: '首页' },
  },
  {
    path: '/home2',
    name: 'HomeT',
    component: () => import('./containers/Home.vue'),
    hidden: true,
    meta: { title: '首页' },
  },
  {
    path: '/DatePicker',
    name: 'DatePicker',
    component: () => import('./containers/DatePicker.vue'),
    meta: { title: '时间选择' },
  },
  {
    path: '/layout',
    name: 'layout',
    meta: { title: '列表布局', icon: layoutIcon },
    component: { render: h => <router-view /> },
    children: [
      {
        path: 'SearchItem',
        name: 'SearchItem',
        component: SearchItem,
        meta: { title: '搜索栏' },
      },
    ],
  },
  {
    path: '/baseCom',
    name: 'baseCom',
    component: { render: h => <router-view /> },
    meta: { title: '基础组件' },
    children: [
      {
        path: 'Pagination',
        name: 'Pagination',
        component: Pagination,
        meta: { title: '分页器' },
      },
      {
        path: 'Transfer',
        name: 'Transfer',
        component: Transfer,
        meta: { title: '穿梭框' },
      },
    ],
  },
  {
    path: '/baseDialog',
    name: 'baseDialog',
    component: { render: h => <router-view /> },
    meta: { title: '基础弹窗' },
    children: [
      {
        path: 'dialog',
        name: 'dialog',
        component: Dialog,
        meta: { title: '弹窗' },
      },
      {
        path: 'NormalDialog',
        name: 'NormalDialog',
        component: NormalDialog,
        meta: { title: '遮罩层弹窗' },
      },
    ],
  },
];

export default new Router({
  // mode: 'history',
  scrollBehavior: () => ({ y: 0 }),
  routes: routerMap,
});
