網(wǎng)上找到的解決方案如下所示
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 這兩個(gè)應(yīng)該是ie特有的樣式吧汞幢,判斷出ie然后手動(dòng)駕駛hashChange事件監(jiān)聽路由變化