UNPKG

ideaz-element

Version:

<p align="center"> <a href="" target="_blank" rel="noopener noreferrer"> <img src="./docs/public/logo.svg" alt="Ideaz Element" width="180" style="width: 180px;" /> </a> </p>

1 lines 1.1 kB
{"version":3,"file":"useExpose.mjs","sources":["../../../packages/hooks/useExpose.ts"],"sourcesContent":["import type { ComponentPublicInstance } from 'vue';\n\nexport const useExpose = (exposing: any) => {\n const instance = getCurrentInstance()!;\n if (!instance) {\n throw new Error('expose should be called in setup().');\n }\n\n const keys = Object.keys(exposing);\n\n keys.forEach((key) => {\n instance.proxy![key as keyof ComponentPublicInstance] = exposing[key];\n });\n\n onBeforeUnmount(() => {\n keys.forEach((key) => {\n instance.proxy![key as keyof ComponentPublicInstance] = exposing[key];\n });\n });\n};\n"],"names":["useExpose","exposing","instance","getCurrentInstance","keys","key","onBeforeUnmount"],"mappings":";AAEa,MAAAA,IAAA,CAAAC,MAAA;AACX,QAAAC,IAAAC,EAAA;AACA,MAAA,CAAAD;AACE,UAAA,IAAA,MAAA,qCAAA;AAGF,QAAAE,IAAA,OAAA,KAAAH,CAAA;AAEA,EAAAG,EAAA,QAAA,CAAAC,MAAA;AACE,IAAAH,EAAA,MAAAG,CAAA,IAAAJ,EAAAI,CAAA;AAAA,EAAoE,CAAA,GAGtEC,EAAA,MAAA;AACE,IAAAF,EAAA,QAAA,CAAAC,MAAA;AACE,MAAAH,EAAA,MAAAG,CAAA,IAAAJ,EAAAI,CAAA;AAAA,IAAoE,CAAA;AAAA,EACrE,CAAA;AAEL;"}