子组件向父组件传值:
//子组件
pickerConfirm(e) { //日期确定
this.$emit("confirm", {
selectDate: this.selectDate
});
},
//父组件:
<choseDate @confirm = "selectDate"></choseDate>
import choseDatefrom '@/components/choseDate/choseDate'
export default {
components: {
choseDate
}
},
methods: {
// 接收子组件传过来的值
selectDate(res){
console.log(res)
},
}
父组件向子组件传值:
//父组件
<son-page :checkProcess="chosecheck"></son-page >
import sonPage from '@/component/son.vue';
components: {
sonPage
}
//子组件
<view v-for="(item, index) in checkProcess" :key="item.value">
<view>{{item.name}}</view>
</view >
export default {
props: ["checkProcess"],
}