mirror of
https://github.com/ArthurDanjou/ui.git
synced 2026-01-25 17:30:37 +01:00
docs(app): framework select global (#2719)
Co-authored-by: harlan <harlan@harlanzw.com>
This commit is contained in:
23
docs/app/composables/useSharedData.ts
Normal file
23
docs/app/composables/useSharedData.ts
Normal file
@@ -0,0 +1,23 @@
|
||||
import { createSharedComposable } from '@vueuse/core'
|
||||
|
||||
function _useSharedData() {
|
||||
const framework = useCookie('nuxt-ui-framework', { default: () => 'nuxt' })
|
||||
const frameworks = computed(() => [{
|
||||
label: 'Nuxt',
|
||||
icon: 'i-logos-nuxt-icon',
|
||||
value: 'nuxt',
|
||||
onSelect: () => framework.value = 'nuxt'
|
||||
}, {
|
||||
label: 'Vue',
|
||||
icon: 'i-logos-vue',
|
||||
value: 'vue',
|
||||
onSelect: () => framework.value = 'vue'
|
||||
}].map(f => ({ ...f, active: framework.value === f.value })))
|
||||
|
||||
return {
|
||||
framework,
|
||||
frameworks
|
||||
}
|
||||
}
|
||||
|
||||
export const useSharedData = createSharedComposable(_useSharedData)
|
||||
Reference in New Issue
Block a user