From d7a6245f8abec23135474d7af97aa6ae8e00a5a5 Mon Sep 17 00:00:00 2001 From: buvta <12312540+buvta@users.noreply.github.com> Date: Mon, 14 Dec 2020 21:13:18 +0800 Subject: [PATCH] =?UTF-8?q?=E5=AF=BC=E5=87=BA=E4=B8=BAjson=E6=A0=BC?= =?UTF-8?q?=E5=BC=8F=E6=97=B6=E8=87=AA=E5=8A=A8=E6=B7=BB=E5=8A=A0=E6=89=A9?= =?UTF-8?q?=E5=B1=95=E5=90=8D?= MIME-Version: 1.0 Content-Type: text/plain; charset=UTF-8 Content-Transfer-Encoding: 8bit --- src/components/EditSites.vue | 5 ++--- src/components/History.vue | 1 + src/components/IPTV.vue | 3 ++- src/components/Star.vue | 5 ++--- 4 files changed, 7 insertions(+), 7 deletions(-) diff --git a/src/components/EditSites.vue b/src/components/EditSites.vue index 6d25378..129fa39 100644 --- a/src/components/EditSites.vue +++ b/src/components/EditSites.vue @@ -342,13 +342,12 @@ export default { const str = JSON.stringify(arr, null, 2) const options = { filters: [ - { name: 'JSON file', extensions: ['json'] }, - { name: 'Normal text file', extensions: ['txt'] }, - { name: 'All types', extensions: ['*'] } + { name: 'JSON file', extensions: ['json'] } ] } remote.dialog.showSaveDialog(options).then(result => { if (!result.canceled) { + if (!result.filePath.endsWith('.json')) result.filePath += '.json' fs.writeFileSync(result.filePath, str) this.$message.success('已保存成功') } diff --git a/src/components/History.vue b/src/components/History.vue index 1297537..22da5e0 100644 --- a/src/components/History.vue +++ b/src/components/History.vue @@ -239,6 +239,7 @@ export default { } remote.dialog.showSaveDialog(options).then(result => { if (!result.canceled) { + if (!result.filePath.endsWith('.json')) result.filePath += '.json' fs.writeFileSync(result.filePath, str) this.$message.success('已保存成功') } diff --git a/src/components/IPTV.vue b/src/components/IPTV.vue index b6be88a..192d68a 100644 --- a/src/components/IPTV.vue +++ b/src/components/IPTV.vue @@ -2,7 +2,7 @@
- 导出 + 导出 导入 检测{{ this.checkAllChannelsLoading ? this.checkProgress + '/' + this.iptvList.length : '' }} 重置 @@ -318,6 +318,7 @@ export default { fs.writeFileSync(result.filePath, writer.toString()) this.$message.success('已保存成功') } else { + if (!result.filePath.endsWith('.json')) result.filePath += '.json' const arr = [...this.channelList] // 要保存channelList必须选json const str = JSON.stringify(arr, null, 2) fs.writeFileSync(result.filePath, str) diff --git a/src/components/Star.vue b/src/components/Star.vue index 06fca6d..62cc3a8 100644 --- a/src/components/Star.vue +++ b/src/components/Star.vue @@ -363,13 +363,12 @@ export default { const str = JSON.stringify(arr, null, 2) const options = { filters: [ - { name: 'JSON file', extensions: ['json'] }, - { name: 'Normal text file', extensions: ['txt'] }, - { name: 'All types', extensions: ['*'] } + { name: 'JSON file', extensions: ['json'] } ] } remote.dialog.showSaveDialog(options).then(result => { if (!result.canceled) { + if (!result.filePath.endsWith('.json')) result.filePath += '.json' fs.writeFileSync(result.filePath, str) this.$message.success('导出收藏成功') }