1.父向子传值
//父组件使用封装的选择物流公司弹层组件,并传值
<expressPop showExpressPop="{{isshow1}}" />
//子组件接收值
properties: {
//显示物流公司弹层
showExpressPop: {
type: Boolean,
value: false
},
},
2.子向父传值
//子组件使用this.triggerEvent("父组件定义的事件名","传递的数据")
this.triggerEvent("myevent",data)
//父组件调用子组件,绑定事件bindmyevent
<expressPop showExpressPop="{{isshow1}}" bindmyevent="selectComapny"/>
//父组件定义的方法中接受子组件传的值
selectComapny(e){
console.log(e);
this.setData({
expressId:e.detail.expressId,
expressName:e.detail.expressName
})
}