|
|
@@ -28,7 +28,9 @@
|
|
|
<script lang="ts" setup>
|
|
|
import { Painter } from '@/utils/Painter'
|
|
|
import { Recorder } from '@/utils/Recorder'
|
|
|
-import { onMounted, ref, nextTick } from 'vue'
|
|
|
+import {
|
|
|
+ onMounted, ref, nextTick, onUnmounted
|
|
|
+} from 'vue'
|
|
|
import { io } from 'socket.io-client'
|
|
|
|
|
|
const painters: any = {}
|
|
|
@@ -112,6 +114,14 @@ onMounted(() => {
|
|
|
socket.connect()
|
|
|
})
|
|
|
})
|
|
|
+
|
|
|
+onUnmounted(() => {
|
|
|
+ if (!socket) return
|
|
|
+ socket.disconnect()
|
|
|
+ context = null
|
|
|
+ canvas = null
|
|
|
+ recorder = null
|
|
|
+})
|
|
|
</script>
|
|
|
<style lang="less" scoped>
|
|
|
.box {
|