一、说明背景
vue主要采用了ES6 Promise,我们知道的,在 JavaScript 中,所有代码都是单线程的,也就是同步执行的。而 Promise 就为异步编程提供了一种解决方案。
二、解决方案
1、采用 babel-polyfill 进行转换语法。
2、安装babel-polyfill
npm install -S babel-polyfill
3、main.js 引入babel-polyfill
import 'babel-polyfill'
注意:babel-polyfill 默认会把node_modules 进行过滤出来(这就是很多引入了babel-polyfill还是不能解决兼容性问题的根本原因)
三、还未解决看下面的操作
1、当你的语法比较规则的时候,可能按照上面的就可以兼容IE8以上了。
2、报错 SCRIPT1006: 缺少 ')'
注意:凡是遇到以上问题,请在vue.config.js中加入,以下是以resize-detector为例
transpileDependencies: [
"resize-detector",
],
3、报错 strict 模式下不...",
<script>
let ua = navigator.userAgent.toLocaleLowerCase();
let browserType = null;
if (ua.match(/msie/) != null || ua.match(/trident/) != null) {
browserType = 'IE';
window.location.href='/runMsg.html';
} else if (ua.match(/firefox/) != null) {
browserType = 'firefox';
} else if (ua.match(/ucbrowser/) != null) {
browserType = 'UC';
window.location.href='/runMsg.html';
} else if (ua.match(/metasr/) != null) {
browserType = 'sougou';
window.location.href='/runMsg.html';
} else if (ua.match(/tencenttraveler/) != null || ua.match(/qqbrowse/) != null) {
browserType = 'QQ';
window.location.href='/runMsg.html';
} else if (ua.match(/maxthon/) != null) {
browserType = 'maxthon';
window.location.href='/runMsg.html';
} else if (ua.match(/chrome/) != null) {
var is360 = _mime('type', 'application/vnd.chromium.remoting-viewer')
if (is360) {
browserType = '360';
window.location.href='/runMsg.html';
} else {
browserType = 'chrome';
}
} else if (ua.match(/safari/) != null) {
browserType = 'Safari'
} else {
browserType = 'others'
}
</script>
还是不能解决,请联系博主!
本文地址:https://blog.csdn.net/xljx_1/article/details/107283938
如对本文有疑问, 点击进行留言回复!!
MFC的静态库.lib、动态库.dll(包含引入库.lib)以及Unicode库示例
CTF 刷题记录(一) 白云新闻搜索(手动与自动化SQL注入)
javascript如何使用函数random来实现课堂随机点名方法详解
网友评论