一个弹出框的子组件,在父组件引用,想要在父组件中,给弹出框的按钮设置不同放方法。比如:
//父组件
data (){
popupdata: {
title:"提示",
content:"您有一份奖品,请点击",
btntext:[
{"text":"确认","meth":this.surepopup},
{"text":"取消","meth":this.closepopup}
]
},
},
methods:{
surepopup:function(){
console.log("sure")
},
closepopup:function(){
console.log("close")
}
}
//子组件
props:[
"popupdata"
],
在这里我是想通过父组件中data里面数据,给不同的按钮分配不同放方法,然后到子组件中的@touchstart="btnt.meth"这里调用,发现没有效果。
不知道有没有别的方式,可以做到这种需求。
Copyright 2014-2025 https://www.php.cn/ All Rights Reserved | php.cn | 湘ICP备2023035733号
http://cn.vuejs.org/guide/com...
vue的官网是中文的,还来这里问。。。。
实现了吗??