File tree Expand file tree Collapse file tree 1 file changed +4
-1
lines changed
packages/sfc-playground/src/output Expand file tree Collapse file tree 1 file changed +4
-1
lines changed Original file line number Diff line number Diff line change 12
12
<script setup lang="ts">
13
13
import Message from ' ../Message.vue'
14
14
import { ref , onMounted , onUnmounted , watchEffect } from ' vue'
15
+ import type { WatchStopHandle } from ' vue'
15
16
import srcdoc from ' ./srcdoc.html?raw'
16
17
import { PreviewProxy } from ' ./PreviewProxy'
17
18
import { MAIN_FILE , SANDBOX_VUE_URL } from ' ../sfcCompiler'
@@ -22,6 +23,7 @@ const runtimeError = ref()
22
23
const runtimeWarning = ref ()
23
24
24
25
let proxy: PreviewProxy
26
+ let updateHandle: WatchStopHandle
25
27
26
28
async function updatePreview() {
27
29
runtimeError .value = null
@@ -93,12 +95,13 @@ onMounted(() => {
93
95
94
96
iframe .value .addEventListener (' load' , () => {
95
97
proxy .handle_links ()
96
- watchEffect (updatePreview )
98
+ updateHandle = watchEffect (updatePreview )
97
99
})
98
100
})
99
101
100
102
onUnmounted (() => {
101
103
proxy .destroy ()
104
+ updateHandle && updateHandle ()
102
105
})
103
106
</script >
104
107
You can’t perform that action at this time.
0 commit comments