mirror of
https://github.com/ArthurDanjou/ui.git
synced 2026-01-14 12:14:41 +01:00
docs: update
This commit is contained in:
@@ -1,28 +0,0 @@
|
||||
const useComponentsMetaState = () => useState('components-meta', () => ({}))
|
||||
|
||||
export async function fetchComponentMeta (name: string) {
|
||||
const state = useComponentsMetaState()
|
||||
|
||||
if (state.value[name]?.then) {
|
||||
await state.value[name]
|
||||
return state.value[name]
|
||||
}
|
||||
if (state.value[name]) { return state.value[name] }
|
||||
|
||||
// Store promise to avoid multiple calls
|
||||
|
||||
// add to nitro prerender
|
||||
if (import.meta.server) {
|
||||
const event = useRequestEvent()
|
||||
event.node.res.setHeader(
|
||||
'x-nitro-prerender',
|
||||
[event.node.res.getHeader('x-nitro-prerender'), `/api/component-meta/${name}.json`].filter(Boolean).join(',')
|
||||
)
|
||||
}
|
||||
state.value[name] = $fetch(`/api/component-meta/${name}.json`).then((meta) => {
|
||||
state.value[name] = meta
|
||||
})
|
||||
|
||||
await state.value[name]
|
||||
return state.value[name]
|
||||
}
|
||||
@@ -1,24 +0,0 @@
|
||||
import pkg from '../../ui-pro2/package.json'
|
||||
|
||||
export function useModule() {
|
||||
const config = useRuntimeConfig().public
|
||||
|
||||
const modules = [{
|
||||
label: 'nuxt/ui',
|
||||
icon: 'i-heroicons-cube-transparent',
|
||||
suffix: `v${config.version}`,
|
||||
value: 'ui'
|
||||
}, {
|
||||
label: 'nuxt/ui-pro',
|
||||
icon: 'i-heroicons-cube-transparent',
|
||||
suffix: `v${pkg.version.split('-')[0]}`,
|
||||
value: 'ui-pro'
|
||||
}]
|
||||
|
||||
const module = useCookie<string>('module', { default: () => modules[0].value })
|
||||
|
||||
return {
|
||||
module,
|
||||
modules
|
||||
}
|
||||
}
|
||||
Reference in New Issue
Block a user