一开始写的
<uni-modle ref="uniModle" @handleButton="handleButton()"></uni-modle>
// 用户点击了弹窗按钮
handleButton(e){
console.log(e);//undefined
},
问题:函数名不需要 套上引号 ,括号也不需要
更正:
<uni-modle ref="uniModle" @handleButton = handleButton></uni-modle>
// 用户点击了弹窗按钮
handleButton(e){
console.log(e);//"我是子组件传出来的值~"
},
搞定!
还没解决?再看一下正确方式: