Files
nuxt__ui/docs/app/components/content/IconsTheme.vue
2025-12-18 13:04:06 +01:00

55 lines
1.1 KiB
Vue

<script setup lang="ts">
import json5 from 'json5'
import { themeIcons } from '../../utils/theme'
const appConfig = useAppConfig()
const icons = computed(() => themeIcons[appConfig.theme.icons as keyof typeof themeIcons || 'lucide'])
const { data: ast } = await useAsyncData(`icons-theme`, async () => {
const md = `
::code-collapse{class="nuxt-only"}
\`\`\`ts [app.config.ts]
export default defineAppConfig(${json5.stringify({
ui: {
icons: icons.value
}
}, null, 2).replace(/,([ |\t\n]+[}|\])])/g, '$1')})
\`\`\`\
::
::code-collapse{class="vue-only"}
\`\`\`ts [vite.config.ts]
import { defineConfig } from 'vite'
import vue from '@vitejs/plugin-vue'
import ui from '@nuxt/ui/vite'
export default defineConfig({
plugins: [
vue(),
ui(${json5.stringify({
ui: {
icons: icons.value
}
}, null, 2).replace(/,([ |\t\n]+[}|\])])/g, '$1')
.split('\n')
.map((line, i) => i === 0 ? line : ` ${line}`)
.join('\n')})
]
})
\`\`\`
::
`
return parseMarkdown(md, { })
}, { watch: [icons] })
</script>
<template>
<MDCRenderer v-if="ast" :body="ast.body" :data="ast.data" />
</template>