diff --git a/packages/web/src/pages/app/[appid]/cloudfunction/[id].vue b/packages/web/src/pages/app/[appid]/cloudfunction/[id].vue index 51c670e979..58486ae329 100644 --- a/packages/web/src/pages/app/[appid]/cloudfunction/[id].vue +++ b/packages/web/src/pages/app/[appid]/cloudfunction/[id].vue @@ -100,16 +100,19 @@ async function updateFunc(showTip = true) { } async function launch() { - const r = await compileFunctionCode(func._id, { - code: value, - }).finally(() => { - loading = false - }) - if (loading) return loading = true + + const r = await compileFunctionCode(func._id, { + code: value, + }).finally( + () => { + loading = false + }, + ) + const param = parseInvokeParam(invokeParams) const res = await launchFunction(r.data, param, debug_token).finally( () => { @@ -318,13 +321,28 @@ onMounted(async () => { nextTick(() => { updateEditorHeight() - document.removeEventListener('keydown', bindShortKey, false) - document.addEventListener('keydown', bindShortKey, false) window.addEventListener('resize', debounce(() => { updateEditorHeight() })) }) }) + +onBeforeUnmount(() => { + document.removeEventListener('keydown', bindShortKey, false) +}) + +onUnmounted(() => { + document.removeEventListener('keydown', bindShortKey, false) +}) + +onActivated(() => { + document.removeEventListener('keydown', bindShortKey, false) + document.addEventListener('keydown', bindShortKey, false) +}) + +onDeactivated(() => { + document.removeEventListener('keydown', bindShortKey, false) +})