-
Notifications
You must be signed in to change notification settings - Fork 4.7k
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
父组件向子组件传函数,子组件能调用, 但是没有返回值 #2286
Comments
欢迎提交 Issue~ 如果你提交的是 bug 报告,请务必遵循 Issue 模板的规范,尽量用简洁的语言描述你的问题,最好能提供一个稳定简单的复现。🙏🙏🙏 如果你的信息提供过于模糊或不足,或者已经其他 issue 已经存在相关内容,你的 issue 有可能会被关闭。 Good luck and happy coding~ |
@Lionad-Morotar 小程序端 props 传函数是利用小程序的 triggerEvent 机制实现的,triggerEvent 只能调用父组件函数,不能获取父组件函数的返回值。 目前我们正在改进小程序的 props 实现,完成后即可拿到返回值,但仍需要一段时间。 你可以先把需要 return 的内容改为 setState,通过 props 传给子组件。 |
Hello~ 您的问题楼上已经有了确切的回答,如果没有更多的问题这个 issue 将在 15 天后被自动关闭。 如果您在这 15 天中更新更多信息自动关闭的流程会自动取消,如有其他问题也可以发起新的 Issue。 Good luck and happy coding~ |
🆗 |
v1.3.0-beta.3貌似没处理 |
@guxingke201 v1.3.0-beta 已经可以拿到父组件函数调用的返回值 |
问题描述
父组件向子组件传函数,子组件能调用, 但是没有返回值
复现步骤
![image](https://user-images.githubusercontent.com/26913795/53539513-d34b6e00-3b4c-11e9-8963-989c54118011.png)
![image](https://user-images.githubusercontent.com/26913795/53539626-510f7980-3b4d-11e9-930b-28c3ff2d9218.png)
![image](https://user-images.githubusercontent.com/26913795/53539660-6e444800-3b4d-11e9-81c8-5e3a7b91ffdb.png)
![image](https://user-images.githubusercontent.com/26913795/53539710-a2b80400-3b4d-11e9-8fd3-a702f571256b.png)
** 1 父组件模板 **
** 2 父组件函数 **
** 3 子组件onClick时执行某函数调用父组件函数 **
** 4 子组件函数执行结果 **
系统信息
The text was updated successfully, but these errors were encountered: