做微信公众号页面时,ios9.3.3 h5的js代码全部失效
描述: 机型iphone6 plus,ios9.3.3 js 代码执行报错
在 umi 中编译生生产代码没问题,但 dev 代码直接在mPaaS环境预览,报错,经过报错位置,怀疑是箭头函数引起
经测试,确实是 iOS 9.3.3 不支持 ES6 以下语法:
- 箭头函数
- let
- const
测试 demo 示例
<!DOCTYPE html>
<html lang="en">
<head>
<meta charset="UTF-8">
<meta http-equiv="X-UA-Compatible" content="IE=edge">
<meta name="viewport" content="width=device-width, initial-scale=1.0">
<title>测试 ios9.3.3</title>
<script src="https://cdn.bootcss.com/vConsole/3.2.0/vconsole.min.js"></script>
<script>new VConsole();</script>
</head>
<body>
<script>
// let str = 'xiaoming';
// console.log('str:', str);
const num = 1;
console.log('num:', num);
var aa = () => {
return 123
}
console.log('arrow function:', aa())
// var __commonJS = (cb, mod) => function __require() {
// return mod || 123
// };
// console.log('arrow function:', __commonJS())
</script>
hah
</body>
</html>