1.子传父
1.
<SlotsOne
@changeUser="changeUser"
@changeBtn="changeBtn"
></SlotsOne>
在父组件对子组件调用位置写上传递方法名称
2.子组件之中setup(props, ctx)
3.子组件之中
return {
...toRefs(state),
ctx,
扫描二维码关注公众号,回复:
15207925 查看本文章
};
4.子组件之中 ctx.emit("changeUser");
如果有传值的话跟vue2一样直接写在方法后面就行ctx.emit("changeUser",true)