refactor(hooks): 重构hook函数取消监听方式

This commit is contained in:
燕博文
2022-12-10 17:52:31 +08:00
parent 70aeefea02
commit fd9488673c
3 changed files with 91 additions and 88 deletions

View File

@ -1,4 +1,4 @@
import { computed, ref } from 'vue';
import { computed, onScopeDispose, ref } from 'vue';
import { useBoolean } from '../common';
/**
@ -42,6 +42,8 @@ export default function useCountDown(second: number) {
counts.value = 0;
}
onScopeDispose(stop);
return {
counts,
isCounting,