From ed1afa202605e7e00e576fe93eacb9ea1f1637af Mon Sep 17 00:00:00 2001 From: haiyangcui Date: Fri, 28 Aug 2020 12:56:55 +0200 Subject: [PATCH] =?UTF-8?q?=E6=B7=BB=E5=8A=A0=E2=80=9C=E9=87=8D=E7=BD=AE?= =?UTF-8?q?=E6=BA=90=E2=80=9D=E5=8A=9F=E8=83=BD?= MIME-Version: 1.0 Content-Type: text/plain; charset=UTF-8 Content-Transfer-Encoding: 8bit --- src/components/Setting.vue | 23 +++++++++++++++++++---- 1 file changed, 19 insertions(+), 4 deletions(-) diff --git a/src/components/Setting.vue b/src/components/Setting.vue index a1903b1..44c4f31 100644 --- a/src/components/Setting.vue +++ b/src/components/Setting.vue @@ -84,10 +84,13 @@
-
导出
+
导出
-
导入
+
导入
+
+
+
重置源
说明文档
@@ -146,6 +149,7 @@ import pkg from '../../package.json' import { setting, sites, shortcut, star } from '../lib/dexie' import { shell, clipboard, remote } from 'electron' import db from '../lib/dexie/dexie' +import { sites as defaultSites } from '../lib/dexie/initData' import fs from 'fs' export default { name: 'setting', @@ -331,7 +335,7 @@ export default { this.$message.error(err) }) }, - expSites () { + exportSites () { this.getSites() const arr = [...this.sitesList] const str = JSON.stringify(arr, null, 4) @@ -351,7 +355,7 @@ export default { this.$message.error(err) }) }, - impSites () { + importSites () { const options = { filters: [ { name: 'JSON file', extensions: ['json'] }, @@ -380,6 +384,17 @@ export default { } }) }, + resetSites () { + sites.clear() + sites.add(defaultSites).then(e => { + this.getSites() + this.d.site = defaultSites[0].key + setting.update(this.d).then(res => { + this.setting = this.d + this.$message.success('重置源成功') + }) + }) + }, changeTheme (e) { this.d.theme = e setting.update(this.d).then(res => {