Skip to content
New issue

Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.

By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.

Already on GitHub? Sign in to your account

fix: 【发行为混合分包】TypeError: t.$callHook is not a function #4829

Open
wants to merge 1 commit into
base: next
Choose a base branch
from

Commits on Apr 11, 2024

  1. fix: 【发行为混合分包】TypeError: t.$callHook is not a function

    1. 当发行为混合分包的时候,uniapp 会调用 initCreateSubpackageApp 方法
    
    2. initCreateSubpackageApp 里调用 parseApp ,并在 onLaunch 时候进行 initBaseInstance
    
    3. initCreateSubpackageApp 里调用 parseApp 后同步执行 `vm.$.ctx.$scope = app;`
    
    4. initBaseInstance 在 onLaunch 会进行 `if (this.$vm && ctx.$scope) {return;}` 阻断,如果通过则执行 `ctx.$hasHook = hasHook;  ctx.$callHook = callHook;` 
    
    问题出在 onLaunch 是异步的,导致 4 的流程阻断,没有执行 $callHook 赋值,最终导致 `initAppLifecycle` 中的 `vm.$callHook` 为 undefined
    viccici committed Apr 11, 2024
    Configuration menu
    Copy the full SHA
    518d7cb View commit details
    Browse the repository at this point in the history