
import VueRouter from 'vue-router';
import Vue from "vue";
Vue.use(VueRouter);

const routes = [
    {
        path:"/",
        redirect: "/index"
    },
    {
        path: "/index",
        name: 'index',
        component: resolve => require(['@/view/index'],resolve)
    },//首页
    {
        path: "/about",
        name: 'About',
        component: resolve => require(['@/view/about'],resolve)
    },//关于我们
    {
        path: "/contact",
        name: 'Contact',
        component: resolve => require(['@/view/contact'],resolve)
    },//联系我们
    {
        path: "/news",
        name: 'News',
        component: resolve => require(['@/view/news'],resolve)
    },//新闻资讯
    {
        path: "/product",
        name: 'Product',
        component: resolve => require(['@/view/product'],resolve)
    },//产品服务
    {
        path: "/trade",
        name: 'Trade',
        component: resolve => require(['@/view/trade'],resolve)
    },//跨境贸易
    {
        path: "/detail",
        name: 'Detail',
        component: resolve => require(['@/view/detail'],resolve)
    }//新闻详情
]

const router = new VueRouter({
  // 这里配置的是路由和组件的映射关系, 是一个数组.
  routes
})
router.beforeEach((to, from, next) => {
    document.body.scrollTop = 0
    // firefox
    document.documentElement.scrollTop = 0
    next()
  })
export default router