1
2
3
4
5
6
7
8
9
10
11
12
13
14
15
16
17
18
19
20
21
22
23
24
25
26
27
28
29
30
31
32
33
34
35
36
37
| Component({
| props: {
| className: '',
| loadMore: false,
| loadContent: ['', ''],
| loadingSize: '',
| loadingColor: ''
| },
| data: {
| loadContent: ['加载更多...', '-- 数据加载完了 --']
| },
| didMount: function didMount() {
| var _this = this;
|
| var loadTxt = this.props.loadContent[0] ? this.props.loadContent[0] : this.data.loadContent[0];
| var overTxt = this.props.loadContent[1] ? this.props.loadContent[1] : this.data.loadContent[1];
| setTimeout(function () {
| _this.setData({
| loadContent: [loadTxt, overTxt]
| });
| }, 0);
| },
| didUpdate: function didUpdate() {
| var _this2 = this;
|
| var loadTxt = this.props.loadContent[0] ? this.props.loadContent[0] : this.data.loadContent[0];
| var overTxt = this.props.loadContent[1] ? this.props.loadContent[1] : this.data.loadContent[1];
|
| if (loadTxt !== this.data.loadContent[0] || overTxt !== this.data.loadContent[1]) {
| setTimeout(function () {
| _this2.setData({
| loadContent: [loadTxt, overTxt]
| });
| }, 0);
| }
| }
| });
|
|