功能:点击下载按钮获取到用户电脑的桌面信息,可选择指定的下载路径,(结合electron框架,桌面端)
<el-table-column prop="fileName" label="日志" align="center">
<template slot-scope="scope">
<div v-show="scope.row.fileName">
<i class="el-icon-share"></i>
<div>{{ scope.row.fileName }}</div>
<el-button type="text" size="small" @click="downClick(scope.row)">下载文件</el-button>
</div>
</template>
</el-table-column>
downClick(row) {
this.fileDown = row.fileName;
var inputObj = document.createElement('input');
inputObj.setAttribute('id', '_ef');
inputObj.setAttribute('type', 'file');
inputObj.setAttribute('style', 'visibility:hidden');
if (row) {
inputObj.setAttribute('webkitdirectory', '');
inputObj.setAttribute('directory', '');
}
document.body.appendChild(inputObj);
inputObj.addEventListener('change', this.updatePath);
inputObj.click();
},