ES6 compatible ie9, flex compatible ie9

vue compatible ES6

Ie9 on the environment, es6 part of the new objects, expressions, does not support, solution is to use  babel-polyfill components, which translates the code into es5 Code es6 low version of the browser can recognize

npm install  babel-polyfill  --save

 

After installation is complete, the main program entry file  main.js can directly refer to the first row:  Import 'Babel-polyfill';

 

Or add an entry in the webpack.base.conf.js in

entry: {
    app: [ 'babel-polyfill', './src/main.js']
  },
 

// above reference sources: https://juejin.im/post/5b2868b46fb9a00e6f65f87e

 

flex compatible ie9

Conditional Notes: Reference https://blog.csdn.net/a460550542/article/details/73521850

Js used herein is determined window .navigator .userAgent whether it contains MSIE or Trident, ie a browser is not identified, then the version number is determined Analyzing ie MSIE browser version, if <= 9 is added in the form lte-ie9 html, after local style needs to be rewritten, it added .lte-ie9 in front styles, plus there is no higher priority than before

ie11:"Mozilla/5.0 (Windows NT 10.0; WOW64; Trident/7.0; .NET4.0C; .NET4.0E; .NET CLR 2.0.50727; .NET CLR 3.0.30729; .NET CLR 3.5.30729; rv:11.0) like Gecko"
ie10:"Mozilla/5.0 (compatible; MSIE 10.0; Windows NT 10.0; WOW64; Trident/7.0; .NET4.0C; .NET4.0E; .NET CLR 2.0.50727; .NET CLR 3.0.30729; .NET CLR 3.5.30729)"
ie09:"Mozilla/5.0 (compatible; MSIE 9.0; Windows NT 10.0; WOW64; Trident/7.0; .NET4.0C; .NET4.0E; .NET CLR 2.0.50727; .NET CLR 3.0.30729; .NET CLR 3.5.30729)"

  

export function isLteIE9() {
  var ms_ie = false;
  var ua = window.navigator.userAgent;
  var old_ie = ua.indexOf('MSIE ');
  var new_ie = ua.indexOf('Trident/');

  if ((old_ie > -1) || (new_ie > -1)) {
    ms_ie = true;
  }

  if (ms_ie) {
    var reIE = new RegExp("MSIE (\\d+\\.\\d+);");
    reIE.test(ua);
    var fIEVersion = parseFloat(RegExp["$1"]);
    if (fIEVersion <= 9) {
      document.documentElement.className += " lte-ie9";
      return true
    }
  }
  return false
}

 

 

 

 

 

Guess you like

Origin www.cnblogs.com/baixinL/p/11933120.html