最近要把vue项目兼容ie11 前面引入bable等一系列操作就不说了,下面说一下具体具体的问题
1 如图所示 SyntaxError: strict 模式下不允许一个属性有多个定义, 点击stack所在行后面的省略号 出现具体的vue文件
可以看到 dirTuihuibz.vue里面有属性重复问题
<el-form-item label="设备类型">
<el-select v-model="equipmentId" placeholder="" clearable @clear="getdirCheHuiTables" placeholder="请选择设备类型名称">
<el-option
v-for="item in equipInfoOptions"
:key="item.id"
:label="item.descrbution"
:value="item.descrbution">
</el-option>
</el-select>
</el-form-item>
可以看到我有2个placeholder 删掉没有用的placeholder就可以了
2 级联选择器在禁用状态下回显内容不显示
.el-cascader__tags .el-tag{
display: inline;
}
给 span 标签 加上display:inline
3 ie11下载excel文件需要用navigator.msSaveBlob(blob,contentDispositionFileName)
//下载excle
downloadExcel(){
this.$axios({
url: this.api.api_eventdeclartion.downloadExcel+'?subject='+this.searchObj.title+'&id='+this.searchObj.bizKey,
method: 'post',
responseType: 'blob',
})
.then((response) => {
const data =response.data
let r = new FileReader()
r.onload = function () {
try {
let resData = JSON.parse(this.result)
if(resData.code){
if(resData.code==401){
localStorage.clear();
window.open(resData.redirectUrl,'_self');
}
}
} catch (e) {
}
}
r.readAsText(data)
this.download(response);
})
.catch((error) => {
});
},
download(data) {
if (!data) {
return
}
var blob = new Blob([data.data])
var aLink = document.createElement("a");
const contentDisposition = data.headers['content-disposition'];
const contentDispositionFileName = decodeURI(contentDisposition.split('=')[1]);
if (!!window.ActiveXObject || "ActiveXObject" in window || navigator.userAgent.indexOf("Edge") > -1) {
navigator.msSaveBlob(blob,contentDispositionFileName)
} else {
var url = window.URL.createObjectURL(blob);
aLink.style.display = "none";
aLink.download=contentDispositionFileName
aLink.href = url;
document.body.appendChild(aLink)
aLink.click()
}
},