文本打字机 - 文本以打字机形式一个个显示

https://blog.csdn.net/qq_41993503/article/details/107640238

{{typewriter}}

data () { return { typewriter: '', i: 0, timer: 0, str: 'Hi, i´m a web Designer' } } mounted () { this.typeing() }, methods: { typeing () { if (this.i <= this.str.length) { this.typewriter = this.str.slice(0, this.i++) + '_' this.timer = setTimeout(() => { this.typeing() }, 150) } else { clearTimeout(this.timer) } } }

你可能感兴趣的:(文本打字机 - 文本以打字机形式一个个显示)