解決vue項目訪問地址自動添加#號問題

新建一個vue項目,訪問地址url後自動添加#號,很不美觀。

在項目路由文件index.js文件中,將路由模式修改爲history,代碼如下:

export default new Router({
  mode: 'history',
  routes: [
    {
      path: '/',
      name: 'HelloWorld',
      component: HelloWorld
    },
    {
      path: '/cardList',
      name: 'cardList',
      component: cardList
    }
  ]
})

 

發表評論
所有評論
還沒有人評論,想成為第一個評論的人麼? 請在上方評論欄輸入並且點擊發布.
相關文章