判断手机系统
let osName = plus.os.name.toLowerCase(); // ios或android
页面通信
// 跳转页面并发送数据
uni.navigateTo({
url:"/pages/chat/customerService",
success(res) {
res.eventChannel.emit("RoomToCustomerService",{
roomNumber: that.roomAllInfo.roomNumber,
roomId: that.roomID
});
}
});
// 在被跳转的页面 接收传递来的数据
let eventChannel = that.getOpenerEventChannel();
eventChannel.on("RoomToCustomerService",function(res){
that.gameRoomInfo = res;
});
调用子组件方法
首先给组件定义一个ref属性(ref=”msgInput”),然后使用 this.$refs.msgInput.function();
<!-- 定义 -->
<chatInput ref="msgInput"></chatInput>
// 使用
this.$refs.msgInput.closeFunction();