File tree Expand file tree Collapse file tree 1 file changed +12
-2
lines changed
src/components/common/Message Expand file tree Collapse file tree 1 file changed +12
-2
lines changed Original file line number Diff line number Diff line change 9
9
</transition >
10
10
</template >
11
11
<script lang="ts" setup>
12
- import { ref , onMounted , onUnmounted } from " vue" ;
12
+ import { ref , onMounted , onBeforeUnmount , defineProps } from " vue" ;
13
13
import type { MessageType } from " ./type" ;
14
14
// 是否可见
15
15
const visible = ref (false );
@@ -26,10 +26,20 @@ const keyDown = () => {};
26
26
// 关闭弹窗
27
27
const close = () => {};
28
28
29
+ const props = defineProps ({
30
+ content: String , // 文字类型
31
+ isHTML: Boolean , // 是否是html
32
+ duration: Number , // 显示时长
33
+ onClose: Function , // 关闭时的调用
34
+ });
35
+
29
36
onMounted (() => {
30
37
console .log (" message box onMounted" );
31
38
});
32
- onUnmounted (() => {
39
+ onBeforeUnmount (() => {
40
+ if (typeof props .onClose === " function" ) {
41
+ props .onClose ();
42
+ }
33
43
console .log (" message box onUnmounted" );
34
44
});
35
45
</script >
You can’t perform that action at this time.
0 commit comments