alibaba / rax

🐰 Rax is a progressive framework for building universal application. https://rax.js.org
Other
8k stars 627 forks source link

Rax组件开发功能中无法使用usePageShow生命周期钩子 #2327

Closed Awen-hub closed 2 years ago

Awen-hub commented 2 years ago

⌨️

Where is the bug from?

Rax Components

Minimal code and steps to reproduce the bug

import { usePageShow } from "rax-app";

Current and expected behavior

在组件开发功能中使用上述代码会有ts报错,rax-app没有导出usePageShow,同时微信小程序开发者工具中会报错。

Environment

-OS:win10 -node:16

build.json

{ "type": "rax", "targets": ["wechat-miniprogram"], "plugins": ["build-plugin-component", "./plugin.js"], "enablePlatformLoader": true, "outputDir": "dist" }

Possible solution

no

Additional context

no

SoloJiang commented 2 years ago

页面级别的生命周期不会直接暴露给组件,避免组件耦合页面的逻辑,如果需要的话,1. 自行通过对应容器的 API 实现;2. 页面级组件给子组件传递钩子