@@ -27,14 +27,16 @@ <h1>Vue CountTo</h1>
27
27
< div class ="example-item ">
28
28
< h3 > simple example</ h3 >
29
29
< code > <count-to :startVal='0' :endVal='2017' :duration=4000></count-to></ code >
30
- < count-to ref ='example1 ' class ='example1 ' :start-val ='0 ' :end-val ='2017 ' :duration =4000 > </ count-to >
31
- < div class ='example-btn ' @click ='start1 '> 开始</ div >
30
+ < count-to ref ='example1 ' class ='example1 ' :start-val =startVal1 :end-val ='endVal1 ' :duration =4000 > </ count-to >
31
+ < div class ='example-btn ' @click ='start1 '> start</ div >
32
+ < div class ='example-btn ' @click ='changeExampleEndVal '> change end-val</ div >
33
+ < div class ='example-btn ' @click ='incrementalUpdate '> incremental update</ div >
32
34
</ div >
33
35
< div class ="example-item ">
34
36
< h3 > count down example</ h3 >
35
37
< code > <count-to :startVal='2017' :endVal='0' :duration=8000></count-to></ code >
36
38
< count-to ref ='example2 ' class ='example2 ' :start-val ='2017 ' :end-val =0 :duration =8000 > </ count-to >
37
- < div class ='example-btn ' @click ='start2 '> 开始 </ div >
39
+ < div class ='example-btn ' @click ='start2 '> start </ div >
38
40
</ div >
39
41
< div class ="example-item ">
40
42
< h3 > custom example</ h3 >
@@ -45,8 +47,8 @@ <h3> custom example</h3>
45
47
< label class ="label " for ="startValInput "> startVal: < input type ="number " v-model.number ='setStartVal ' name ='startValInput ' /> </ label >
46
48
< label class ="label " for ="endValInput "> endVal: < input type ="number " v-model.number ='setEndVal ' name ='endVaInput ' /> </ label >
47
49
< label class ="label " for ="durationInput "> duration: < input type ="number " v-model.number ='setDuration ' name ='durationInput ' /> </ label >
48
- < div class ="startBtn example-btn " @click ='start3 '> 开始 </ div >
49
- < div class ="pause-resume-btn example-btn " @click ='pauseResume '> 暂停/恢复 </ div >
50
+ < div class ="startBtn example-btn " @click ='start3 '> start </ div >
51
+ < div class ="pause-resume-btn example-btn " @click ='pauseResume '> pause/resume </ div >
50
52
< br />
51
53
< label class ="label " for ="decimalsInput "> decimals: < input type ="number " v-model.number ='setDecimals ' name ='decimalsInput ' /> </ label >
52
54
< label class ="label " for ="separatorInput "> separator: < input v-model ='setSeparator ' name ='separatorInput ' /> </ label >
@@ -70,7 +72,9 @@ <h3> custom example</h3>
70
72
setDecimals : 0 ,
71
73
setSeparator : ',' ,
72
74
setSuffix : ' rmb' ,
73
- setPrefix : '¥ '
75
+ setPrefix : '¥ ' ,
76
+ startVal1 :0 ,
77
+ endVal1 :2017
74
78
}
75
79
} ,
76
80
computed : {
@@ -117,6 +121,13 @@ <h3> custom example</h3>
117
121
} ,
118
122
} ,
119
123
methods : {
124
+ changeExampleEndVal ( ) {
125
+ this . endVal1 = this . endVal1 + 1000
126
+ } ,
127
+ incrementalUpdate ( ) {
128
+ this . startVal1 = this . endVal1
129
+ this . endVal1 = this . endVal1 + 1000
130
+ } ,
120
131
callback ( ) {
121
132
console . log ( 'callback' )
122
133
} ,
0 commit comments