tdesign-vue-next
Version:
TDesign Component for vue-next
1 lines • 1.14 kB
Source Map (JSON)
{"version":3,"file":"withInstall.mjs","sources":["../../../components/utils/withInstall.ts"],"sourcesContent":["import { App, Plugin, Component, Directive } from 'vue';\n\nfunction withInstall<T>(\n comp: T,\n alias?: string,\n directive?: { name: string; comp: Directive<T & Plugin> },\n): T & Plugin {\n const componentPlugin = comp as T & Component & Plugin;\n\n componentPlugin.install = (app: App, name?: string) => {\n app.component(alias || name || componentPlugin.name, comp);\n directive && app.directive(directive.name, directive.comp);\n };\n\n return componentPlugin as T & Plugin;\n}\n\nexport default withInstall;\n"],"names":["withInstall","comp","alias","directive","componentPlugin","install","app","name","component"],"mappings":";;;;;;AAEA,SAASA,WAAAA,CACPC,IACA,EAAAC,KAAA,EACAC,SACY,EAAA;EACZ,IAAMC,eAAkB,GAAAH,IAAA,CAAA;AAERG,EAAAA,eAAA,CAAAC,OAAA,GAAU,UAACC,GAAA,EAAUC,IAAkB,EAAA;AACrDD,IAAAA,GAAA,CAAIE,SAAU,CAAAN,KAAA,IAASK,IAAQ,IAAAH,eAAA,CAAgBG,MAAMN,IAAI,CAAA,CAAA;AACzDE,IAAAA,SAAA,IAAaG,GAAI,CAAAH,SAAA,CAAUA,SAAU,CAAAI,IAAA,EAAMJ,UAAUF,IAAI,CAAA,CAAA;GAC3D,CAAA;AAEO,EAAA,OAAAG,eAAA,CAAA;AACT;;;;"}