`
start
{{ num }}
`
`
start(startNum, maxNum) {
var that = this
let numText = startNum
let golb
// 為了清除requestAnimationFrame
function numSlideFun() {
// 數字動畫
numText += 5
// 速度的計算可以為小數 。數字越大,滾動越快
if (numText >= maxNum) {
numText = maxNum
cancelAnimationFrame(golb)
} else {
golb = requestAnimationFrame(numSlideFun)
}
that.amount = numText
// console.log(numText)
}
numSlideFun()
// 呼叫數字動畫
}
`