|
@@ -21,11 +21,18 @@ export default defineComponent({
|
|
|
this.initializeRoom()
|
|
|
RuntimeUtils.loopSyncLike()
|
|
|
event.on(LIVE_EVENT_MESSAGE['RC:Chatroom:Like'], this.onLikeMessage)
|
|
|
+ window.onbeforeunload = this.beforeunload
|
|
|
},
|
|
|
beforeUnmount() {
|
|
|
event.off(LIVE_EVENT_MESSAGE['RC:Chatroom:Like'], this.onLikeMessage)
|
|
|
+ window.onbeforeunload = null
|
|
|
},
|
|
|
methods: {
|
|
|
+ beforeunload() {
|
|
|
+ if (runtime.videoStatus === 'liveing') {
|
|
|
+ return '当前正在直播中是否确认关闭页面?'
|
|
|
+ }
|
|
|
+ },
|
|
|
onLikeMessage(msg: any) {
|
|
|
runtime.likeCount += msg.counts
|
|
|
},
|