一、渲染過程
父組件掛載完成一定是子組件掛載完成之后,才算是父組件掛載完成,所以父組件的mounted在組件間的mounted之后。
父beforeCreate-->父created-->父beforeMounte-->子beforeCreate-->子created-->子beforeMounte-->子mounted-->父mounted
二、子組件更新過程:
1.影響到父組件:父beforeUpdate-->子beforeUpdate-->子updated-->父updated
2.不影響父組件:子beforeUpdate-->子updated
三、父組件更新過程:
1.影響到子組件:父beforeUpdate-->子beforeUpdate-->子updated-->父updated
2.不影響子組件:父beforeUpdate-->父updated
四、銷毀過程
父beforeDestroy-->子beforeDestroy-->子destroyed-->父destroyed
看起來很多很難記憶,其實只要理解了,不管哪兒種情況,都一定是父組件等待子組件完成后,才會執(zhí)行自己對應(yīng)完成的鉤子,就可以很容易記憶。