diff --git a/packages/anu-vue/src/index.ts b/packages/anu-vue/src/index.ts index bade4a8a..87be4077 100644 --- a/packages/anu-vue/src/index.ts +++ b/packages/anu-vue/src/index.ts @@ -1,3 +1,4 @@ +import { defu } from 'defu' import type { App } from 'vue' import * as components from './components' import { provideAppSpacing } from '@/composables/useSpacing' @@ -7,12 +8,17 @@ export interface PluginOptions { registerComponents: boolean } +const optionsDefaults: Partial = { + registerComponents: true, +} + const plugin = { - install(app: App, options?: PluginOptions) { + install(app: App, options: Partial = {}) { provideAppSpacing(app) - // console.log('components :>> ', components); - if (options && options.registerComponents) { + const _options = defu(options, optionsDefaults) + + if (_options.registerComponents) { for (const prop in components) { // @ts-expect-error: I want to index import using string const component = components[prop]