isIE = () => {
if (!!window.ActiveXObject || 'ActiveXObject' in window) {
return true;
} else {
return false;
}
};
//下载补充协议
//agreementFilePath
handleDetail = (row) => {
if (this.isIE()) {
// IE
window.open(row.agreementFilePath, '_blank');
} else {
let a = document.createElement('a'); // 创建a标签
let e = document.createEvent('MouseEvents'); // 创建鼠标事件对象
e.initEvent('click', false, false); // 初始化事件对象
a.href = row.agreementFilePath; // 设置下载地址
a.download = row.name; // 设置下载文件名
a.dispatchEvent(e);
}
};
React开发(139):ant design学习指南之下载文件
