BreathlessWay

Results 2 comments of BreathlessWay

> 能否给一个示例,否则不知道你的使用场景和需求是什么 因为想使用 localforage 进行数据缓存,而 localforage 的 getItem 是一个异步行为

> 或许你可以自己使用 Promise 包裹一层,这边暂时不考虑异步行为。 但是文档中提及可以使用 IndexDB,IndexDB 本身也是异步的 ![image](https://github.com/InhiblabCore/vue-hooks-plus/assets/18589559/b0c682c5-4ff8-4a89-96cf-782388ee4647) 如果在 geCache 中进行 Promise 返回,那返回的值被转为 ref 时会直接变成 undefined,缓存就失效了 ![image](https://github.com/InhiblabCore/vue-hooks-plus/assets/18589559/a9f4d597-063d-4b66-ad23-83c2f4fca6cc) 如果 getCache 中是同步行为,就不存在缓存失效的问题 ![image](https://github.com/InhiblabCore/vue-hooks-plus/assets/18589559/906aac3b-2c54-4e93-941d-d8a72df54b86)