Files

29 lines
379 B
TypeScript
Raw Permalink Normal View History

2025-07-21 16:47:04 +08:00
import { reactive, watch } from "vue";
import { isDark } from "../theme";
type CacheData = {
key: number;
};
type UseCache = {
cache: CacheData;
};
export const useCache = (source: () => any[]): UseCache => {
const cache = reactive<CacheData>({
key: 0
});
watch(source, () => {
cache.key++;
});
watch(isDark, () => {
cache.key++;
});
return {
cache
};
};