feat: 优化md渲染组件性能表现

This commit is contained in:
539943419 committed 2025-03-25 13:38:56 +08:00
1 parent c1be93739d
commit d20dc84d9d
4 files changed
+44 -31

No files matched your search

+11
View File
@@ -0,0 +1,11 @@
import useDefaultStore from "~/hooks/pinia/useDefaultStore"
export default async function cachedPromise<T>(key: string, promise: () =>Promise<T>): Promise<T> {
const cache = useDefaultStore().getCache(key)
if (cache) {
return cache
}
const res = await promise()
useDefaultStore().setCache(key, res)
return res
}