工具-页面搭建-打开位置-功能调整

main
ysn 2 weeks ago
parent 675f7e5012
commit d8d1fff4cb
  1. 22
      src/views/utility/index.vue

@ -142,13 +142,23 @@ export default {
// //
// 访 // 访
handleOpenPath(row) { handleOpenPath(row) {
try { // const link = document.createElement("a");
this.$message.error( // link.href = row.filePath;
`由于浏览器安全限制,无法直接打开本地文件夹。<br><br>文件夹路径:<code>${row.folderPath}</code><br><br>请在文件资源管理器中手动打开此路径。` // link.download = row.name;
// link.click();
// 4. a
const link = document.createElement("a");
link.href = row.filePath;
link.download = row.name; // +
document.body.appendChild(link);
link.click();
// 5.
document.body.removeChild(link);
window.URL.revokeObjectURL(downloadUrl);
//
this.$message.info(
"文件已开始下载,请在浏览器下载列表右键打开文件所在文件夹"
); );
} catch (e) {
this.$message.error("打开失败:" + e.message);
}
}, },
}, },
}; };

Loading…
Cancel
Save