网上找到的解决方案如下所示
new Vue({
el: '#app',
router,
store,
render: function (createElement) {
if ('-ms-scroll-limit' in document.documentElement.style && '-ms-ime-align' in document.documentElement.style) {
window.addEventListener('hashchange', () => {
var currentPath = window.location.hash.slice(1)
if (this.$route.path !== currentPath) {
this.$router.push(currentPath)
}
}, false)
}
return createElement(App);
}
})
-ms-scroll-limit 和 -ms-ime-align 这两个应该是ie特有的样式吧,判断出ie然后手动驾驶hashChange事件监听路由变化