vue-cli scaffolding hungry plug-ins do not achieve routing navigation menu Jump

Use hungry yet ui components of a navigation menu, plus router after routing attributes can not be achieved index jump, click void and error

After investigation found problems in the routing configuration of the above

code show as below:

const router = new vueRouter({
    mode:"history",
    routes:[
        {path:'/index',component:Index,children:[
            {path:'/users',component:Users},
        ]},
        {path:'/login',component:Login},
        // {path:'*',redirect:'/index'},
    ]
})

In the routing rules which use the mode: "history", the property, in order to remove vue-router comes with  # number, the more concise path,

But also added automatically jump code when accessing the wrong address

// {path: '*',

redirect: '/ index'}, this time has a bug

When you click when hungry yet ui navigation menu component, the browser will find the address / users, but vue-router in the default address should be '/ # / users', so the browser will think no address is found, the / users think that is incorrect address comes to jump

The default address / index of the home side, there is no equivalent in the visual jump, in fact the page to jump twice, the first time jump / users find did not find, the second jump back '/ index' of

Resulting in the emergence of the bug, the bug no error prompt, belonging to a logical error.

 

Guess you like

Origin www.cnblogs.com/BR-Tao/p/11359148.html