順序:
父beforeCreated -> 父created-> 父beforeMounted->子beforeCreated ->子created->子beforeMounted->子mounted->父mounted->父beforeUpdata->子beforeUpdata->子updata->父updata->父beforeDestroyed->子beforeDestroyed->子destroyed->父destroyed
常用方式:
希望父組件加載完成在加載子組件:
在子組件上添加v-if=‘isShow’ isShow默認值是false灿渴,在父組件的mounted中將isShow變成true,執(zhí)行順序變成如下:
父beforeCreated -> 父created-> 父beforeMounted->父mounted->父beforeUpdata->子beforeCreated ->子created->子beforeMounted->子mounted->子beforeUpdata->子updata->父updata->父beforeDestroyed->子beforeDestroyed->子destroyed->父destroyed
***在mounted中才可以觸發(fā)updated,