dcloudio / dcloudio/mui

React 中使用mui 框架 如何绑定tap事件

Open
#184 2 comments 0 reactions 0 assignees View on GitHub
Dominant language
JavaScript
Stars
13.5k
Forks
6.5k
PR merge metrics
No merged PRs in 30d

Description

绑定tap事件后貌似无法阻止穿透现象

`class ShoppingList extends React.Component {
state = {shoppingList: [],count:0};
constructor(props) {
super(props);
window.fetch("http://private-62bc7-pc6.apiary-mock.com/fit_infos?city=1000001")
.then((response)=> {
return response.json()
})
.then((json)=> {
this.setState({shoppingList: json.datas})
})
.catch((ex)=> {
})
}
addCount=(e)=>{
e.preventDefault();
e.stopPropagation();
console.log(this)
};
render() {
return


    {this.state.shoppingList.map((item, index)=> {
    return
  • {item.c_name}



  • })}

}
componentDidUpdate=()=>{
window.addEventListener('tap', this.addCount);
}
}`

Contributor guide

No contributing guide indexed for this repository

Assessment

This issue has not been assessed yet.

Get new issues in your inbox

A short digest of beginner-friendly GitHub issues.