search

Home  >  Q&A  >  body text

javascript - Regarding the problem of variables in vue methods.

Why do I have to use this to save the timer variable, otherwise it will prompt Undefined.

高洛峰高洛峰2776 days ago664

reply all(1)I'll reply

  • ringa_lee

    ringa_lee2017-05-19 10:19:09

    Originally both functions will use that variable, and the parallel functions have independent scopes.
    It must be mounted in a context that everyone can access, and this context is an instance of vue, which is this

    reply
    0
  • Cancelreply