Fe-interview: [vue] 组件进来请求接口时你是放在哪个生命周期?为什么?

Created on 20 Jun 2019  ·  2Comments  ·  Source: haizlin/fe-interview

[vue] 组件进来请求接口时你是放在哪个生命周期?为什么?

vue

Most helpful comment

一般在created 因为在这个生命周期我们常用到的都已经初始化好了
如果涉及dom 那就mounted

All 2 comments

一般在created 因为在这个生命周期我们常用到的都已经初始化好了
如果涉及dom 那就mounted

created => 因为在这个生命周期我们常用到的都已经初始化好了
涉及到需要页面加载完成之后的话就用 mounted,可以操作 dom

Was this page helpful?
0 / 5 - 0 ratings