import Vue from 'vue'
import VueRouter from 'vue-router'
import index from '../views/index.vue'
import food from '../views/food.vue'
import contact from '../views/contact.vue'
import recruit from '../views/recruit.vue'
import news from '../views/news.vue'

Vue.use(VueRouter)

const routes = [{
    path: '/',
    redirect: "/index",
    meta: {
        title: '醉面美食【唯一官网】',
        keyword: '醉面美食,',
        description: '北京肉酱面品类领先者,加盟咨询热线400-878-124.'
    }
},
    {
        path: '/index',
        component: index,
        meta: {
            title: '醉面美食【唯一官网】',
            keyword: '醉面美食,',
            description: '北京肉酱面品类领先者,加盟咨询热线400-878-124.'
        }
    },
    {
        path: '/food',
        component: food,
        name: 'food',
        meta: {
            title: '醉面美食【唯一官网】',
            keyword: '醉面美食,',
            description: '北京肉酱面品类领先者,加盟咨询热线400-878-124.'
        }
    },
    {
        path: '/news',
        component: news,
        name: 'news',
        meta: {
            title: '醉面美食【唯一官网】',
            keyword: '醉面美食,',
            description: '北京肉酱面品类领先者,加盟咨询热线400-878-124.'
        }
    },
    {
        path: '/contact',
        component: contact,
        name: 'contact',
        meta: {
            title: '醉面美食【唯一官网】',
            keyword: '醉面美食,',
            description: '北京肉酱面品类领先者,加盟咨询热线400-878-124.'
        }
    },
  {
    path: '/recruit',
    component: recruit,
    name: 'recruit',
    meta: {
      title: '醉面美食【唯一官网】',
      keyword: '醉面美食,',
      description: '北京肉酱面品类领先者,加盟咨询热线400-878-124.'
    }
  },

]

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

//获取原型对象上的push函数
const originalPush = VueRouter.prototype.push
//修改原型对象中的push方法
VueRouter.prototype.push = function push(location) {
    return originalPush.call(this, location).catch(err => err)
}

export default router
