search

Home  >  Q&A  >  body text

javascript - When does vue request data to save global variables?

The business needs to request the dictionary in the background data and save it as a global variable first.
I initially thought that app.vue should be created first, and then the component, so when I put the request data in created in the app, I found that the dictionary data in the component was still in the initial state. I found that their rendering order is that the component is rendered first and then app.vue
How can I get this dictionary in each component? I don’t want to request each component again

某草草某草草2795 days ago747

reply all(3)I'll reply

  • 伊谢尔伦

    伊谢尔伦2017-05-16 13:44:18

    Actually, I just want to persist a piece of data. vuex is an option, and localstorage can also be used.

    reply
    0
  • 淡淡烟草味

    淡淡烟草味2017-05-16 13:44:18

    Is vuex useful?

    reply
    0
  • 世界只因有你

    世界只因有你2017-05-16 13:44:18

    Integrate vuex

    reply
    0
  • Cancelreply