import * as React from 'react';
import { Button } from 'antd';
import { RouteComponentProps } from 'react-router';
//定义变量
interface CounterState {
count: number;
}
export class TableFormAll extends React.Component<RouteComponentProps<{}>, CounterState>{
//constructor(props: RouteComponentProps<{}>) {
// super(props);
// this.state = {
// count: 0
// };
//}
//初始化赋值
state = {
count: 0
};
render() {
return <div>
<p>测试</p>
<Button onClick={this.handleAdd}>点击 +1</Button>
<Button onClick={this.handleDeletd.bind(this)}>点击 -1</Button>
<p>{this.state.count}</p>
</div>
}
handleAdd = () => {
this.setState({
count: this.state.count + 1
});
}
handleDeletd() {
this.setState({
count: this.state.count - 1
})
}
}