File tree Expand file tree Collapse file tree 1 file changed +10
-1
lines changed Expand file tree Collapse file tree 1 file changed +10
-1
lines changed Original file line number Diff line number Diff line change 1515 'is-close': close,
1616 'is-center': center,
1717 }"
18+ @mouseenter =" clearTimer"
19+ @mouseleave =" startTimer"
1820 >
1921 <jw-icon
2022 class =" jw-message-icon"
@@ -75,19 +77,26 @@ const props = defineProps(messageProps);
7577const emits = defineEmits (messageEmits );
7678
7779const visible = ref (false );
80+ let stopTimer = undefined ;
81+
7882const customStyle = computed (() => ({
7983 top: ` ${props .offset }px ` ,
8084 zIndex: props .zIndex ,
8185}));
8286
8387function startTimer() {
8488 if (props .duration > 0 ) {
85- setTimeout (() => {
89+ stopTimer = setTimeout (() => {
8690 if (visible .value ) close ();
8791 }, props .duration );
8892 }
8993}
9094
95+ function clearTimer() {
96+ clearTimeout (stopTimer );
97+ stopTimer = undefined ;
98+ }
99+
91100function close() {
92101 visible .value = false ;
93102}
You can’t perform that action at this time.
0 commit comments