子组件给父组件传值,父组件中的data打印不出来
子组件中
this.$confirm('是否继续完善信息?', '提示', {
confirmButtonText: '确定',
cancelButtonText: '取消',
type: 'warning'
}).then(() => {
console.log('进入then'); //这个可以出来
this.$emit('listenTochildEvent','子组件传值');
}).catch(() => {
this.$message({
type: 'success',
message: '可点击“完善”继续完善信息'
});
});
父组件中
//Vue
<preparation-basic-detail-comp @listenTochildEvent="listenTochildEvent">
</preparation-basic-detail-comp>
//JS
listenTochildEvent(data){
console.log(data); //出不来
}
好了 在this.$confirm前面加个阻塞await就好了,此贴终结