Wie im Bild oben gezeigt: Undefiniert wird zuerst gedruckt. Liegt ein Problem mit der Ausführungsreihenfolge vor? Bete alle gro?en G?tter an
created 觸發(fā)時說明 Vue 組件的數(shù)據(jù)都準備好了,這個時候父組件還沒執(zhí)行 created 獲取 courseToll 所以傳給子組件的是 undefined 。父組件獲取之后改變了 courseToll 所以后來又觸發(fā)了一遍。
子組件暴露出courseToll屬性,父組件用v-bind:courseToll="courseTollInFatherComponent"將值傳遞給子組件,然后父組件在created事件回調(diào)里將取到的值賦值給父組件對應的屬性行了。