Vue知识点-改变路由的哈希模式(去掉路由中的#)


1、改变路由的哈希模式(在路由中会出现#):
  在src/router/index.js中

    创建路由对象:
      const routes = [

{path:"",redirect:"/home"},

{path:"/home",component:Home},

{path:"/cart",comsponent:Cart},

{path:"/profile",component:Profile},

{path:"/category",component:Cart},

]

 

const router  = new Vuerouter({

  routes,

  mode:'history'

})

export default router

 

将mode改为"history"


免责声明!

本站转载的文章为个人学习借鉴使用,本站对版权不负任何法律责任。如果侵犯了您的隐私权益,请联系本站邮箱yoyou2525@163.com删除。



 
粤ICP备18138465号  © 2018-2025 CODEPRJ.COM