unset.ts 392 B

123456789101112131415161718192021
  1. import { isUnset as isStoreUnset } from "@/store";
  2. import { nextTick } from "vue";
  3. export const unsetFactory = () => {
  4. let isUnSet = false;
  5. const unSet = (fn: () => void) => {
  6. console.error('unset')
  7. const pop = isStoreUnset.push(true)
  8. isUnSet = true;
  9. fn();
  10. nextTick(pop)
  11. };
  12. return {
  13. get isUnSet() {
  14. return isStoreUnset.value
  15. },
  16. unSet
  17. }
  18. };