1. In which life cycle is the asynchronous request suitable for invocation?
官方实例
The asynchronous request is mounted
called in the life cycle, but in fact it can also be called in the created life cycle.
I recommend calling asynchronous requests in the created hook function, which has the following advantages:
- It can
更快
be obtained服务端数据
,减少
page loading time; ssr
BeforeMount and mounted hook functions are not supported, so placing them in created will help consistency;