(name = '$style')
| 6 | : {} |
| 7 | |
| 8 | export const useCssModule = (name = '$style'): Record<string, string> => { |
| 9 | const instance = getCurrentInstance() |
| 10 | if (!instance) { |
| 11 | __DEV__ && warn(`useCssModule must be called inside setup()`) |
| 12 | return EMPTY_OBJ |
| 13 | } |
| 14 | |
| 15 | const mod = (instance.proxy as any)?.[name] |
| 16 | if (!mod) { |
| 17 | __DEV__ && |
| 18 | warn(`Current instance does not have CSS module named "${name}".`) |
| 19 | return EMPTY_OBJ |
| 20 | } |
| 21 | |
| 22 | return mod as Record<string, string> |
| 23 | } |
| 24 | |
| 25 | /** |
| 26 | * @deprecated use `useCssModule` instead. |
searching dependent graphs…