From fd7e737e8c4f4958c8d59d5f844f40cf1509724f Mon Sep 17 00:00:00 2001 From: roymondchen Date: Wed, 23 Apr 2025 15:05:14 +0800 Subject: [PATCH] =?UTF-8?q?feat(vue-runtime-help):=20app=E4=B8=8D=E5=AD=98?= =?UTF-8?q?=E5=9C=A8=E6=97=B6=E6=8A=9B=E5=BC=82=E5=B8=B8=EF=BC=8C=E4=BF=9D?= =?UTF-8?q?=E8=AF=81app=E4=B8=80=E5=AE=9A=E5=AD=98=E5=9C=A8=EF=BC=8C?= =?UTF-8?q?=E9=81=BF=E5=85=8D=E5=A4=9A=E4=BD=99=E7=9A=84=E5=8F=AF=E9=80=89?= =?UTF-8?q?=E9=93=BE?= MIME-Version: 1.0 Content-Type: text/plain; charset=UTF-8 Content-Transfer-Encoding: 8bit --- runtime/vue-runtime-help/package.json | 2 +- runtime/vue-runtime-help/src/hooks/use-app.ts | 8 ++++++-- 2 files changed, 7 insertions(+), 3 deletions(-) diff --git a/runtime/vue-runtime-help/package.json b/runtime/vue-runtime-help/package.json index f2f81f0c..1d65c2ed 100644 --- a/runtime/vue-runtime-help/package.json +++ b/runtime/vue-runtime-help/package.json @@ -1,5 +1,5 @@ { - "version": "1.1.1", + "version": "1.1.2", "name": "@tmagic/vue-runtime-help", "type": "module", "sideEffects": false, diff --git a/runtime/vue-runtime-help/src/hooks/use-app.ts b/runtime/vue-runtime-help/src/hooks/use-app.ts index 071a87d5..a69942c4 100644 --- a/runtime/vue-runtime-help/src/hooks/use-app.ts +++ b/runtime/vue-runtime-help/src/hooks/use-app.ts @@ -65,13 +65,17 @@ export const registerNodeHooks = (node?: TMagicNode, methods: Methods = {}) => { }; export const useApp = ({ - methods = {}, + methods, config, iteratorContainerId, iteratorIndex, }: UseAppOptions) => { const app = inject('app'); + if (!app) { + throw new Error(`component ${config.type}: app is not injected`); + } + const node = useNode( { config, @@ -81,7 +85,7 @@ export const useApp = ({ app, ); - if (node) { + if (node && methods) { registerNodeHooks(node, methods); }