nuxt / icon

The <Icon> component, supporting Iconify, Emojis and custom components.

Home Page:https://stackblitz.com/edit/nuxt-icon-playground?file=app.vue

Geek Repo:Geek Repo

Github PK Tool:Github PK Tool

Using nuxt-icon in a custom module

avxkim opened this issue · comments

module.ts

installModule('nuxt-icon', {
  size: '24px',
})

But inlineOptions doesn't work, when i'm enabling this module inside a custom module.

You can use nuxt.options.icon.size = '24px @avxkim

@Atinux then i have to use useRuntimeConfig() in a component?

i did this way:

module.ts

    nuxt.options.runtimeConfig.public.iconSize =
      options.iconSize

then in a component

const config = useRuntimeConfig()

const iconSize = computed(
  () => props.size || config.public.iconSize
)

is that ok?

Oh my bad I just saw that we are using the app.config.ts for the configuration.

Could you try with nuxt.options.appConfig.icon.size = '24px' ?

Cannot start nuxt: Cannot set properties of undefined (setting 'size')

@Atinux is doing this

nuxt.options.runtimeConfig.public.iconSize =
      options.iconSize

considerd as a bad practice?

You can do this yes