-
Notifications
You must be signed in to change notification settings - Fork 4.8k
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
useImperativeHandle 如何使用 #5376
Comments
欢迎提交 Issue~ 如果你提交的是 bug 报告,请务必遵循 Issue 模板的规范,尽量用简洁的语言描述你的问题,最好能提供一个稳定简单的复现。🙏🙏🙏 如果你的信息提供过于模糊或不足,或者已经其他 issue 已经存在相关内容,你的 issue 有可能会被关闭。 Good luck and happy coding~ |
暴露出的 hooks api 与 typing 是对得上的啊 |
useImperativeHandle 需要配合 forwardRef 源代码里面 这个 关键字 但是并没有导出 |
可以这样使用
|
@luckyadam @Chen-jj 能不能说明下为啥没有导出这个api? |
Taro 2.0.7这样使用也不行 |
taro 2到底父组件 怎么调用子组件方法呢? useImperativeHandle forwardRef 又是阉割版的 唉 |
问题描述
'@tarojs/taro' 中含有 useImperativeHandle 方法 但是 d.ts 的描述文件里面写的是 react 的 无法正常在 hooks 中使用
hooks 无法传入 第二个参数 ref
目前要如何 才能在 hooks 中使用 ref 暴露出去 这个组件
期望行为
添加 正确的 useImperativeHandle 使用说明 或者更新 d.ts 文件
系统信息
Taro CLI 2.0.1 environment info:
System:
OS: macOS 10.15.2
Shell: 5.7.1 - /bin/zsh
Binaries:
Node: 13.2.0 - /usr/local/bin/node
Yarn: 1.21.1 - ~/.yarn/bin/yarn
npm: 6.13.1 - /usr/local/bin/npm
npmGlobalPackages:
typescript: 3.7.4
The text was updated successfully, but these errors were encountered: