mirror of
https://github.com/nuxt/ui.git
synced 2026-09-14 19:51:10 +08:00
28 lines
735 B
TypeScript
28 lines
735 B
TypeScript
export function useFrameworks() {
|
|
const framework = useCookie('nuxt-ui-framework', { default: () => 'nuxt' })
|
|
const { track } = useAnalytics()
|
|
|
|
function setFramework(value: 'nuxt' | 'vue', source?: string) {
|
|
framework.value = value
|
|
track('Framework Switched', { framework: value, source: source || 'search' })
|
|
}
|
|
|
|
const frameworks = computed(() => [{
|
|
label: 'Nuxt',
|
|
icon: 'i-simple-icons-nuxtdotjs',
|
|
value: 'nuxt',
|
|
onSelect: () => setFramework('nuxt')
|
|
}, {
|
|
label: 'Vue',
|
|
icon: 'i-simple-icons-vuedotjs',
|
|
value: 'vue',
|
|
onSelect: () => setFramework('vue')
|
|
}].map(f => ({ ...f, active: framework.value === f.value })))
|
|
|
|
return {
|
|
framework,
|
|
setFramework,
|
|
frameworks
|
|
}
|
|
}
|