父子組件掛載渲染過程
子組件更新過程:
- 影響到父組件: 父beforeUpdate -> 子beforeUpdate->子updated -> 父updated
- 不影響父組件: 子beforeUpdate -> 子updated
父組件更新過程:
- 影響到子組件: 父beforeUpdate -> 子beforeUpdate->子updated -> 父updated
- 不影響子組件: 父beforeUpdate -> 父updated
銷毀過程:
父beforeDestroy -> 子beforeDestroy -> 子destroyed -> 父destroyed
不管是哪種情況,都一定是父組件等待子組件完成后,才會執行自己對應完成的鈎子
父組件掛載完成一定是等子組件都掛載完成后,才算是父組件掛載完,所以父組件的mounted在子組件mounted之后。