功能需求
原理
代码
主要代码
1>componentDidMount 加载完毕以后,执行一次
2>showSaveCover 展示后,立即执行隐藏
- componentDidMount() {
- this.showSaveCover();
- }
- showSaveCover() {
- this.setState({
- isWarning: true
- });
- this.hideSaveCover();
- }
- hideSaveCover() {
- var self = this;
- if (this.timer) {
- clearTimeout(this.timer);
- }
- this.timer = setTimeout(() => {
- self.setState({
- isWarning: false
- });
- },1000);
- }