Nie możesz wybrać więcej, niż 25 tematów Tematy muszą się zaczynać od litery lub cyfry, mogą zawierać myślniki ('-') i mogą mieć do 35 znaków.

30 wiersze
785 B

4 lat temu
import React, {Component} from 'react';
import PubSub from 'pubsub-js'
class New extends Component {
constructor(props) {
super(props);
this.state = {
num: 5,
ztext: 'yasaka'
}
}
fun = () => {
this.setState({num: this.state.num + 1})
}
render() {
return (
<div>
父组件传过来值为 ---- {this.props.text} -- {this.state.num}
<button onClick={this.fun}>click</button>
<button onClick={this.props.call.bind(this,this.state.ztext)}>up data</button>
<button onClick={()=>{
PubSub.publish("vtt","call you!")
}}>call pub</button>
</div>
);
}
}
export default New;