1 在父組件的coment綁定事件
<template> <div :class="classObj" class="app-wrapper"> <app-main v-on:child-say="listenToMyBoy" /> </div> </template>
在父組件的methods中添加
listenToMyBoy(something){
this.childWords = something
}
2 在子組件中改變值
this.$emit('child-say',this.loadingStatus)
另外 子組件獲取父組件的值
this.$parent.childWords //childWords為父組件的數據或者方法