> 文章列表 > nuxt.js 在IE浏览器||其他浏览不识别document/window 情况处理

nuxt.js 在IE浏览器||其他浏览不识别document/window 情况处理

nuxt.js 在IE浏览器||其他浏览不识别document/window 情况处理

1 第一步注册到nuxt.config.js文件

2 第二步建立js 文件

 import Vue from 'vue'
 (function(){
    if(process.client){
     console.log(process.client)
    }else{
      console.log(process.client)
    }
    if (!!window.ActiveXObject || "ActiveXObject" in window){
      console.log('====IE浏览器====')
      document.getElementById('__nuxt').innerHTML = `<div style="background-color:black;
      color: red;font-size:22px;text-align:center;height:100px;line-height:100px;">官方IE浏览器停止运维</div>`
      Vue.prototype.$IE = true;
    }else{
      Vue.prototype.$IE = false;
      console.log('====非IE浏览器====')
    }
})();