美文网首页
如何将vue项目中地址上的#去掉

如何将vue项目中地址上的#去掉

作者: 柒秒时光 | 来源:发表于2020-05-10 14:35 被阅读0次

    vue-router 设置 history 模式

    vue-router 默认为 hash 模式,使用默认的 hash 模式,浏览器 URL 地址中会有一个 #,如果有需求要讲#去掉就将vue-router 设置 history 模式

    const router = new Router({
      mode: 'history',
      routes: [......]
    })
    

    相关文章

      网友评论

          本文标题:如何将vue项目中地址上的#去掉

          本文链接:https://www.haomeiwen.com/subject/cfdjnhtx.html