vue生命週期函數有哪些
來源:趣味經驗館 2.91W
品牌型號:聯想 YOGA 14c/系統版本:windows7Vue生命週期函數有:beforeCreate、created、beforeMount、mounted、beforeupdate、updated、beforeDestroy、destroyed、activated、deactivated、errorCaptured。
1、beforeCreate:組件實例剛被創建,組件屬性計算之前。
2、Created:組件實例剛被創建,屬性已綁定,但DOM還未生成。
3、beforeMount:模板編譯/掛載之前。
4、Mounted:模板編譯/掛載之後。
5、beforeUpdate:組件更新之前。
6、Updated:組件更新之後。
7、beforeDestroy:組件銷燬前調用。
8、Destroyed:組件銷燬後調用。
9、activated:組件激活時調用。
10、deactivated:組件停用時調用。
11、errorCaptured:當捕獲一個來自子孫組件的錯誤時被調用。
(web自學教程)