vue-router

Posted yanyiyi

tags:

篇首语:本文由小常识网(cha138.com)小编为大家整理,主要介绍了vue-router相关的知识,希望对你有一定的参考价值。

/**
 *
 *  路由参考例子说明
 * ‘/flowhistory‘:{     -----------url跳转后显示的内容
    name:‘flowhistory‘,     -----------路由跳转关键字,这里作强制要求,必须与url跳转内容一致
        component: function(resolve){
        require([‘./views/glocalme-flowhistory.vue‘],resolve);      -----------模块所在位置
    },
    auth: true      -----------模块是否需要路由验证
},
 *
 *
 */
‘use strict‘;

export default function(router) {
    router.map({
       
        ‘/‘: {
            name: ‘index‘,
            component: function (resolve) {
                require([‘./views/index.vue‘], resolve);
            }
        },

        ‘*‘: {
            name: ‘404‘,
            component: function (resolve) {
                require([‘./views/404.vue‘], resolve);
            }
        },

        ‘/components‘: {
            name: ‘components‘,
            component: function (resolve) {
                require([‘./views/components.vue‘], resolve);
            }
        },
‘/login‘: { name: ‘login‘, component: function (resolve) { require([‘./views/login.vue‘], resolve); } }, /** * 主页 * 时间:2016-11-17 * 负责人:chenwenxiao * */ ‘/home‘: { name: ‘home‘, component: function (resolve) { require([‘./views/index.vue‘], resolve); }, auth: true, subRoutes: { ‘/homePage‘: { name: ‘homePage‘, component: function (resolve) { require([‘./views/page/home.vue‘], resolve); }, auth: true }, ‘/rdtest‘: { name: ‘rdtest‘, component: function (resolve) { require([‘./views/page/systemManager/rdtest.vue‘], resolve); }, auth: true } } } }

 

以上是关于vue-router的主要内容,如果未能解决你的问题,请参考以下文章

百行代码带你入门 vue-router!

typescript vue-router代码分裂

Vue-Router

vue2.0有哪些变化

Vue.js 生态之vue-router

Vue.js 生态之Vue-router 基础三