CDN引入vue不兼容IE浏览器

1、es6标准的省略“function”的写法,IE不兼容;

// es6写法
data() {
    return {}
}

// 兼容IE写法
data: function{
    return {}
}

2、es6箭头函数也不兼容

// 异步写法
async getData(){
    const res = await axios.get("");
}

// 异步写法和箭头函数需要改为function
getData(){
    const that = this
    const res = axios.get("")
        .then(function(){
        // that
    });
}

参考
[踩坑]CDN引入vue不兼容IE浏览器,SCRIPT1003: 缺少 ‘:’,Promise未定义

發表評論
所有評論
還沒有人評論,想成為第一個評論的人麼? 請在上方評論欄輸入並且點擊發布.
相關文章