vue監聽子組件生命週期

偶爾看到的,以爲很好玩:vue 好比有父組件Parent和子組件Child,若是父組件監聽到子組件掛載mounted就作一些邏輯處理,常規的寫法可能以下:web // Parent.vue <Child @mounted="doSomething"/> // Child.vue mounted() { this.$emit("mounted"); } 這裏提供一種特別簡單的方式,子組件不須要
相關文章
相關標籤/搜索