Commit 381943078fd55123fde3d5555e04f279d7f1c407
1 parent
26f251e1
fix(cropper): cropper not destroy in time
图片剪裁组件未能及时销毁资源 fixed: #1027
Showing
2 changed files
with
11 additions
and
1 deletions
CHANGELOG.zh_CN.md
src/components/Cropper/src/Cropper.vue
... | ... | @@ -12,7 +12,7 @@ |
12 | 12 | </template> |
13 | 13 | <script lang="ts"> |
14 | 14 | import type { CSSProperties } from 'vue'; |
15 | - import { defineComponent, onMounted, ref, unref, computed } from 'vue'; | |
15 | + import { defineComponent, onMounted, ref, unref, computed, onUnmounted } from 'vue'; | |
16 | 16 | import Cropper from 'cropperjs'; |
17 | 17 | import 'cropperjs/dist/cropper.css'; |
18 | 18 | import { useDesign } from '/@/hooks/web/useDesign'; |
... | ... | @@ -93,6 +93,10 @@ |
93 | 93 | |
94 | 94 | onMounted(init); |
95 | 95 | |
96 | + onUnmounted(() => { | |
97 | + cropper.value?.destroy(); | |
98 | + }); | |
99 | + | |
96 | 100 | async function init() { |
97 | 101 | const imgEl = unref(imgElRef); |
98 | 102 | if (!imgEl) { | ... | ... |