diff --git a/entrypoints/popup/Popup.vue b/entrypoints/popup/Popup.vue index 2e9efdf..38a8fcb 100644 --- a/entrypoints/popup/Popup.vue +++ b/entrypoints/popup/Popup.vue @@ -114,6 +114,7 @@ watch(isCheckTw5, (newValue, oldValue) => { checkStatus() } else { // @ts-ignore + // 清空 status status.value = '' // ElMessage({ // message: '关闭 TiddlyWiki 5.x 检测', @@ -122,8 +123,17 @@ watch(isCheckTw5, (newValue, oldValue) => { } }) +const isChecking = ref(false) function checkStatus() { + if (isChecking.value) { + ElMessage({ + message: "正在检测中 ..." + }) + + return + } + fetch(`http://localhost:${port.value}/status`).then((res) => { return res.json() }).then((data) => { @@ -138,16 +148,19 @@ function checkStatus() { type: 'error' }) } else { - // ElMessage({ - // message: 'TiddlyWiki 连接成功', - // type: 'success' - // }) + ElMessage({ + message: 'TiddlyWiki 连接成功', + type: 'success' + }) } }).catch((e) => { - ElMessage({ - message: "TiddlyWiki 未成功连接" + e, - type: 'error' - }) + // TODO: 这里总会提示报错,但是实际已经连接成功了 + // ElMessage({ + // message: "TiddlyWiki 未成功连接" + e, + // type: 'error' + // }) + }).finally(() => { + isChecking.value = false }) } @@ -317,11 +330,11 @@ const save2TiddlyWiki = async (title: string, text: string, port: number, url: s {{ json.name.toUpperCase() }}: {{ json.version }} - - + + - - + + diff --git a/package.json b/package.json index fd34bde..9cf9549 100644 --- a/package.json +++ b/package.json @@ -1,8 +1,8 @@ { - "name": "Usewiki2", + "name": "usewiki2", "description": "manifest.json description", "private": true, - "version": "0.0.9", + "version": "0.0.10", "type": "module", "scripts": { "dev": "wxt",