Should vue get back-end data in created or mounted method?

should vue acquire backend data in created or mounted method

Mar.22,2021

depends. Generally, you can put it in created. In this way, you can send a request to obtain data as soon as possible. If you have to rely on dom, put it in mounted () {this.$nextTick (() = > {/ * code * /})}


I prefer to put it in mounted, because sometimes I have to combine ref operation


if there is more data requested asynchronously. Will it cause the page to be rendered. The data didn't bind successfully.
is there a resolve on a route like angular

Menu