Vue.js: Outputting contents of an array one element at a time with delay

Viewed 1807

In my Vue instance's data property, I have an array of strings.

data() {
  return { myArray: [] }
}

This array is filled with words of a sentence. For example:

['Hi', 'my', 'name', 'is', 'foo']

I would like to output the sentence to a paragraph tag in my template one word at a time, with a 1 second delay in between, similar to how a teleprompter would work:

[0 sec] - Hi

[1 sec] - Hi my

[2 sec] - Hi my name

[3 sec] - Hi my name is

[4 sec] - Hi my name is foo

Any help is appreciated.

2 Answers
Related