Răsfoiți Sursa

[ui] Vue 3 - Foxed callHooks in wrapper utils

sreenaths 4 ani în urmă
părinte
comite
91864e7300
1 a modificat fișierele cu 5 adăugiri și 2 ștergeri
  1. 5 2
      desktop/core/src/desktop/js/vue/wrapper/utils.ts

+ 5 - 2
desktop/core/src/desktop/js/vue/wrapper/utils.ts

@@ -27,9 +27,12 @@ export function injectHook (options: KeyHash, key: string, hook: Function) {
 
 export function callHooks (vm: ComponentPublicInstance | undefined, hook: string) {
   if (vm) {
-    const hooks = vm.$options[hook] || [];
+    let hooks = vm.$options[hook] || [];
+    if(!Array.isArray(hooks)) {
+      hooks = [hooks];
+    }
     hooks.forEach((hook: Function) => {
-      hook.call(vm)
+      hook.call(vm);
     });
   }
 }