浏览代码

1.安卓原生插件js消息通知

lovetiya 4 年之前
父节点
当前提交
81b39d59fd
共有 1 个文件被更改,包括 21 次插入1 次删除
  1. 21 1
      jhlive/jhlive.nvue

+ 21 - 1
jhlive/jhlive.nvue

@@ -9,7 +9,9 @@
       :roomid="roomId" 
       :isAuthor="isAuthor"
       :linkMic="linkMic" 
-      :liveEvent="handleLiveEvent" />
+      @onError="onError"
+	  @onRemoteUserEnterRoom="onRemoteUserEnterRoom"
+	  @onRemoteUserLeaveRoom="onRemoteUserLeaveRoom" />
     <view class="top_left_box">
       <image class="top_left_box_img" :src="avatar"></image>
       <view class="top_left_box_text">
@@ -138,6 +140,24 @@ export default {
         });
       }
     },
+	onError: (e)=> {
+		uni.showToast({
+		  title: e.detail,
+		  duration: 2000
+		});
+        this.$emit('onError', e.detail);
+    },
+	onRemoteUserEnterRoom: (e)=> {
+		if(this.remoteUsers.find(v=>v==e.detail)) {
+			this.remoteUsers.push(e.detail);
+			this.$emit('onRemoteUser', this.remoteUsers);
+		}
+	},
+	onRemoteUserLeaveRoom: (e)=> {
+		this.remoteUsers = this.remoteUsers.filter(v=>v!=e.detail);
+		this.$emit('onRemoteUser', this.remoteUsers);
+	}
+	
 	}
 };
 </script>