Showing
1 changed file
with
11 additions
and
4 deletions
| ... | ... | @@ -192,15 +192,22 @@ |
| 192 | 192 | } |
| 193 | 193 | }; |
| 194 | 194 | |
| 195 | - onMounted(() => { | |
| 196 | - getCameraList(); | |
| 197 | - }); | |
| 198 | - onUnmounted(() => { | |
| 195 | + const handleVideoOut = () => { | |
| 199 | 196 | if (unref(cameraList).length) { |
| 200 | 197 | unref(cameraList).forEach((item) => { |
| 201 | 198 | outVideo(item.id); |
| 202 | 199 | }); |
| 203 | 200 | } |
| 201 | + }; | |
| 202 | + | |
| 203 | + onMounted(() => { | |
| 204 | + getCameraList(); | |
| 205 | + }); | |
| 206 | + onUnmounted(() => { | |
| 207 | + handleVideoOut(); | |
| 208 | + }); | |
| 209 | + window.addEventListener('beforeunload', function () { | |
| 210 | + handleVideoOut(); | |
| 204 | 211 | }); |
| 205 | 212 | |
| 206 | 213 | const listEl = ref(); | ... | ... |