首页 > 求助:vue.router的history用法

求助:vue.router的history用法

let router = new VueRouter({
hashbang: true,
history: true,
saveScrollPosition: true,
transitionOnLoad: true
})
之所以开启vue-router的history,我是觉得能方便使用它的定位功能,就是从详细页面返回列表页面能自动定位。
但随之带来了刷新问题。
不使用history,url格式为http://xxx.xxx.xxx/index#!goodslist
使用history后,url格式为http://xxx.xxx.xxx/goodslist。
请问,使用history如何能给我每一个url地址自动添加/index#! 。


history.pushstate 自己写进去?


前端路由模式有两种 一种是 hash 模式,使用 # 导航。另一种是 Html5HistoryAPI 模式,不使用 #。
你开启了 history 就是使用 Html5HistoryAPI 模式,使用这个模式不会添加 #


都开了history模式为什么还要这个#!呢?

【热门文章】
【热门文章】