diff --git a/src/common/event/PlatForm/hook.ts b/src/common/event/PlatForm/hook.ts new file mode 100644 index 0000000..0ebe033 --- /dev/null +++ b/src/common/event/PlatForm/hook.ts @@ -0,0 +1,5 @@ +import { PlatForm } from "." + +export function usePlatForm() { + return PlatForm.getInstance() +} diff --git a/src/common/event/PlatForm/index.ts b/src/common/event/PlatForm/index.ts index a94ba38..4393b90 100644 --- a/src/common/event/PlatForm/index.ts +++ b/src/common/event/PlatForm/index.ts @@ -22,6 +22,10 @@ class PlatForm extends _Base { return this.api.call("PlatFormCommand.fullscreen") } + async reload() { + return this.api.call("PlatFormCommand.reload") + } + async toggleDevTools() { return this.api.call("PlatFormCommand.toggleDevTools") } diff --git a/src/common/usePlatform.ts b/src/common/usePlatform.ts deleted file mode 100644 index 85f70ea..0000000 --- a/src/common/usePlatform.ts +++ /dev/null @@ -1,9 +0,0 @@ -import { PlatForm } from "./event/PlatForm" -import { Tabs } from "./event/Tabs" - -export function usePlatForm() { - return { - Tabs: Tabs.getInstance(), - PlatForm: PlatForm.getInstance(), - } -} diff --git a/src/renderer/src/components/NavBar.vue b/src/renderer/src/components/NavBar.vue index 78594bf..db0bc27 100644 --- a/src/renderer/src/components/NavBar.vue +++ b/src/renderer/src/components/NavBar.vue @@ -42,9 +42,9 @@ import icon from "@res/icon.png" import config from "config" import { PopupMenu } from "@/bridge/PopupMenu" - import { usePlatForm } from "common/usePlatform" + import { usePlatForm } from "common/event/PlatForm/hook" - const { PlatForm } = usePlatForm() + const PlatForm = usePlatForm() const router = useRouter() const route = useRoute() @@ -80,6 +80,12 @@ PlatForm.toggleDevTools() }, }, + { + label: "重载", + async click() { + PlatForm.reload() + }, + }, ]) const obj = e.target.getBoundingClientRect() menu.show({ x: ~~obj.x, y: ~~(obj.y + obj.height) })