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
在 Taro 中另一个不同是你不能使用 catchEvent 的方式阻止事件冒泡。你必须明确的使用 stopPropagation。例如,阻止事件冒泡你可以这样写:
catchEvent
stopPropagation
class Toggle extends Component { constructor (props) { super(props) this.state = {isToggleOn: true} } onClick = (e) => { e.stopPropagation() // 阻止事件冒泡 this.setState(prevState => ({ isToggleOn: !prevState.isToggleOn })) } render () { return ( <button onClick={this.onClick}> {this.state.isToggleOn ? 'ON' : 'OFF'} </button> ) } }
The text was updated successfully, but these errors were encountered:
No branches or pull requests
在 Taro 中另一个不同是你不能使用
catchEvent
的方式阻止事件冒泡。你必须明确的使用stopPropagation
。例如,阻止事件冒泡你可以这样写:The text was updated successfully, but these errors were encountered: