关于生成的URL地址http://localhost:8080/#/后面的/#/

是路由的hash和history之分,默认是hash模式,会有#,把mode改成history,就没了

摘自:https://www.cnblogs.com/zbx-boke/p/9506376.html

vue中常用的路由模式

  • hash(#):默认路由模式

  • histroy(/)切换路由模式

切换路由模式

export default new Router({
    // 路由模式:hash(默认),history模式
    mode: 'history',
    // 修改路由高亮样式,默认值为'router-link-active'
    linkActiveClass: 'active'
    //路由规则
    routes:[
        {
            path:'/',
            name:'index',
            component:'Index'
        }
    ],

})
posted @ 2019-02-20 14:05  IT小菜鸟1  阅读(1341)  评论(0编辑  收藏  举报