js实现打字机效果函数方法
typing () {
const speed = 30
let i = this.typingIndex
if (this.typingTimer !== null) return
this.typingTimer = setInterval(() => {
this.animatedDisplay = this.animatedText.slice(0, i)
i++
this.typingIndex = i
if (i > this.animatedText.length) {
this.typingIndex = 0
clearInterval(this.typingTimer)
this.animatedText = ''
}
}, speed)
},