美文网首页
vue兼容IE11

vue兼容IE11

作者: 马太啊啊 | 来源:发表于2019-04-19 14:41 被阅读0次

1.vue-router
在App.vue里面的mounted周期添加判断

 mounted () {
   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)
   }
}

2.vuex
https://babeljs.io/docs/en/babel-polyfill/

webpack下的配置
我的项目里的配置

好像就这两个 = =

相关文章

网友评论

      本文标题:vue兼容IE11

      本文链接:https://www.haomeiwen.com/subject/whiqgqtx.html