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