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 @@