We read every piece of feedback, and take your input very seriously.
To see all available qualifiers, see our documentation.
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
支付宝小程序
https://github.com/WEN-JY/taro-demo 小程序基础库: 1.25.7 使用框架: React
clone 仓库,安装依赖 启动:yarn dev:alipay 进入小程序调试
期望能够给自定义组件custom-comp1传递函数作为参数,便于自定义原生组件内部回调父组件进行数据通信
以on开头的参数被当做了事件,执行时出发eventHandle校验type失败报错,非on开头的函数原生组件内无法接收到传递的函数,为undefined
Taro CLI 3.5.0-canary.1 environment info: System: OS: macOS 11.5 Shell: 5.8 - /bin/zsh Binaries: Node: 16.13.1 - ~/.nvm/versions/node/v16.13.1/bin/node Yarn: 1.22.10 - /usr/local/bin/yarn npm: 8.1.2 - ~/.nvm/versions/node/v16.13.1/bin/npm npmPackages: @tarojs/components: 3.5.0-canary.1 => 3.5.0-canary.1 @tarojs/mini-runner: 3.5.0-canary.1 => 3.5.0-canary.1 @tarojs/react: 3.5.0-canary.1 => 3.5.0-canary.1 @tarojs/runtime: 3.5.0-canary.1 => 3.5.0-canary.1 @tarojs/taro: 3.5.0-canary.1 => 3.5.0-canary.1 @tarojs/webpack-runner: 3.5.0-canary.1 => 3.5.0-canary.1 babel-preset-taro: 3.5.0-canary.1 => 3.5.0-canary.1 eslint-config-taro: 3.5.0-canary.1 => 3.5.0-canary.1 react: ^17.0.0 => 17.0.2
页面入口:
import { Component } from 'react' import { View, Text } from '@tarojs/components' import './index.scss' export default class Index extends Component { handleCustomClick = (...args) => { console.log('child custom component clicked',...args) } render() { return ( <View className='index'> {/* 三方原生组件 */} <custom-comp1 onComponentClick={this.handleCustomClick} onComponentClick1={this.handleCustomClick} onComponentClick2={this.handleCustomClick} onComponentClick23={this.handleCustomClick} onComponentClick4={this.handleCustomClick} onComponentClick5={this.handleCustomClick} componentClick={this.handleCustomClick} someAttr='1' ></custom-comp1> <Text>Hello world!</Text> <view onTap={this.handleCustomClick}>内置原生组件</view> </View> ) } }
custom-comp:
报错信息: 以on开头的函数: 普通函数:
The text was updated successfully, but these errors were encountered:
#11835
Sorry, something went wrong.
No branches or pull requests
相关平台
支付宝小程序
复现仓库
https://github.com/WEN-JY/taro-demo
小程序基础库: 1.25.7
使用框架: React
复现步骤
clone 仓库,安装依赖
启动:yarn dev:alipay
进入小程序调试
期望结果
期望能够给自定义组件custom-comp1传递函数作为参数,便于自定义原生组件内部回调父组件进行数据通信
实际结果
以on开头的参数被当做了事件,执行时出发eventHandle校验type失败报错,非on开头的函数原生组件内无法接收到传递的函数,为undefined
环境信息
页面入口:
custom-comp:
报错信息:
以on开头的函数:
普通函数:
The text was updated successfully, but these errors were encountered: