element-plus
Version:
A Component Library for Vue 3
1 lines • 1 kB
Source Map (JSON)
{"version":3,"file":"use-cache.mjs","names":[],"sources":["../../../../../../../packages/components/virtual-list/src/hooks/use-cache.ts"],"sourcesContent":["import { computed, getCurrentInstance } from 'vue'\nimport { memoize } from 'lodash-unified'\nimport memoOne from 'memoize-one'\n\nimport type { VirtualizedProps } from '../props'\n\nexport const useCache = <T>() => {\n const vm = getCurrentInstance()!\n\n const props = vm.proxy!.$props as VirtualizedProps\n\n return computed<(_: any, __: any, ___: any) => Record<string, T>>(() => {\n // eslint-disable-next-line @typescript-eslint/no-unused-vars\n const _getItemStyleCache = (_: any, __: any, ___: any) =>\n ({}) as Record<string, T>\n return props.perfMode\n ? memoize(_getItemStyleCache)\n : memoOne(_getItemStyleCache)\n })\n}\n"],"mappings":";;;;;AAMA,MAAa,iBAAoB;CAG/B,MAAM,QAFK,oBAAoB,CAEd,MAAO;AAExB,QAAO,eAAiE;EAEtE,MAAM,sBAAsB,GAAQ,IAAS,SAC1C,EAAE;AACL,SAAO,MAAM,WACT,QAAQ,mBAAmB,GAC3B,QAAQ,mBAAmB;GAC/B"}