A页面需要的参数
data(){
return{
testdata: {
principalUsername: null, //审批人
principalUserid: null, //审批人ID
},
}
onShow() {
let that = this
uni.$on('updateData', function(data) {
that.testdata = data
// const params = 'id:'+data.principalUserid+', name:'+data.principalUsername;
// console.log('监听到事件来自 updateData ,携带参数为:' + params);
})
},
B页面选中的参数
自定义导航栏上的确认按钮
<uni-nav-bar left-icon="back" title="选择审批人" @clickLeft="allleft" @clickRight="add" color="#4C4C4C">
<view slot="right">
<view class="button" >
确认
</view>
</view>
</uni-nav-bar>
data() {
return {
testdata: {
principalUsername:'千千',//名称
principalUserid:21,//年龄
},
}
},
//确认按钮
add() {
uni.$emit('updateData', this.testdata)
uni.navigateBack({
delta: 1
})
},