zoukankan      html  css  js  c++  java
  • 一篇关于兼容问题的基础总结

    1.添加兼容文件(以 es5-shim 为例)

    方法一:

    <script src="https://cdnjs.cloudflare.com/ajax/libs/es5-shim/4.5.7/es5-shim.min.js"></script>
    

      

    在你的开发中,在需要为他做兼容的文件引入改文件

    方法二(以模块引入):

    在你开发项目中(react/vue/ng)等模块开发,在入口文件中引入

    require(es5-shim)
    

      

    2.常见的兼容文件

    es5-shim            可以让一些低级浏览器支持最新ecmascript5的一些属性

    es5-shim/es5-sham        可以让一些低级浏览器支持最新ecmascript5的一些属性

    console-polyfill          使低级浏览器支持console函数

    es6-promise           让不支持promise的浏览器支持es6的promise

    fetch-ie8            让ie8支持fetch

    core-js             兼容es6的Object.assign  函数

    html5shiv                                兼容IE8  的html5标签

    fixpng                                     让所有PNG 支持透明

    //错误信息 Exception thrown and not caught 
    //export * from 'xxx' 编译成了 Object.defineProperty, 而 IE8 中不支持 accessor property
    //require('es5-shim') require('es5-shim/es5-sham')
    
     
    
    //fetch
    //需要引入 es6-promise fetch-ie8
    
     
    
    //Promise 
    //需要引入 es6-promise
    
    
    //Object.assign
    //需要引入 core-js
    

      

    个人博客 :很多好用的 npm 包 , 可以看看  https://gilea.cn/ 

  • 相关阅读:
    Mint linux中调整屏幕亮度的方法
    poj 1085 Triangle War (状压+记忆化搜索)
    CF1060F Shrinking Tree
    leetcode492
    leetcode258
    leetcode226
    leetcode371
    leetcode104
    leetcode389
    leetcode448
  • 原文地址:https://www.cnblogs.com/jiebba/p/6514163.html
Copyright © 2011-2022 走看看