我已设置路由器以接受锚标记
const router = new VueRouter({
mode: 'history',
scrollBehavior: function(to, from, savedPosition) {
if (to.hash) {
return {selector: to.hash}
} else {
return {x: 0, y: 0}
}
},
routes: routes,
});
如果我点击刷新
,这很好http://localhost/mypage#anchorlocation
我得到了WSOD,对主页的反应很好。我怎么能抓到这个?
答案 0 :(得分:0)
这与vue-router
无关,因为只要您使用mode: 'history'
使用您偏好的服务器配置查看https://router.vuejs.org/en/essentials/history-mode.html。