From 984b5494483babcbf5c8fc24b81a99d7ea1a3945 Mon Sep 17 00:00:00 2001 From: MengYX Date: Sun, 23 Feb 2020 13:45:30 +0800 Subject: [PATCH] #19 Add Download Type: Origin Filename --- src/App.vue | 10 +++++----- src/component/util.js | 9 ++++++--- 2 files changed, 11 insertions(+), 8 deletions(-) diff --git a/src/App.vue b/src/App.vue index 729f720..f18d2c8 100644 --- a/src/App.vue +++ b/src/App.vue @@ -7,10 +7,10 @@ 歌曲命名格式: - 歌曲名 - 歌手-歌曲名 - 歌曲名-歌手 - 立即保存 + 歌手-歌曲名 + 歌曲名 + 歌曲名-歌手 + 同原文件名 下载全部 @@ -65,7 +65,7 @@ tableData: [], playing_url: "", playing_auto: false, - download_format: '2', + download_format: '1', instant_download: false, } }, diff --git a/src/component/util.js b/src/component/util.js index c0202f3..8d49bae 100644 --- a/src/component/util.js +++ b/src/component/util.js @@ -2,16 +2,19 @@ export function DownloadBlobMusic(data, format) { const a = document.createElement('a'); a.href = data.file; switch (format) { + default: case "1": - a.download = data.title + "." + data.ext; + a.download = data.artist + " - " + data.title + "." + data.ext; break; - default: case "2": - a.download = data.artist + " - " + data.title + "." + data.ext; + a.download = data.title + "." + data.ext; break; case "3": a.download = data.title + " - " + data.artist + "." + data.ext; break; + case "4": + a.download = data.rawFilename + "." + data.ext; + break; } document.body.append(a); a.click();