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('导出收藏成功') }