页面销毁时关闭sseSource

pull/80/head
panlinlin 2021-04-06 15:13:23 +08:00
parent 20dca0f6b6
commit deef511362
1 changed files with 4 additions and 0 deletions

View File

@ -71,6 +71,10 @@ export default {
},
destroyed() {
window.removeEventListener('beforeunload', e => this.beforeunloadHandler(e))
this.sseSource.removeEventListener('open', null);
this.sseSource.removeEventListener('message', null);
this.sseSource.removeEventListener('error', null);
this.sseSource.close();
// window.removeEventListener('unload', e => this.unloadHandler(e))
},
}