mirror of
https://github.com/ArthurDanjou/ui.git
synced 2026-01-14 12:14:41 +01:00
docs(app): add theme query in examples page
This commit is contained in:
@@ -1,8 +1,20 @@
|
|||||||
<script setup lang="ts">
|
<script setup lang="ts">
|
||||||
const route = useRoute()
|
const route = useRoute()
|
||||||
|
const colorMode = useColorMode()
|
||||||
|
const appConfig = useAppConfig()
|
||||||
|
|
||||||
const name = route.params.slug?.[0]
|
const name = route.params.slug?.[0]
|
||||||
|
|
||||||
|
if (route.query.theme) {
|
||||||
|
colorMode.preference = route.query.theme === 'light' ? 'light' : 'dark'
|
||||||
|
}
|
||||||
|
if (route.query.neutral) {
|
||||||
|
appConfig.ui.colors.neutral = route.query.neutral as string
|
||||||
|
}
|
||||||
|
if (route.query.primary) {
|
||||||
|
appConfig.ui.colors.primary = route.query.primary as string
|
||||||
|
}
|
||||||
|
|
||||||
const width = computed(() => route.query.width && Number.parseInt(route.query.width as string) > 0 ? `${Number.parseInt(route.query.width as string) - 2}px` : '864px')
|
const width = computed(() => route.query.width && Number.parseInt(route.query.width as string) > 0 ? `${Number.parseInt(route.query.width as string) - 2}px` : '864px')
|
||||||
</script>
|
</script>
|
||||||
|
|
||||||
|
|||||||
Reference in New Issue
Block a user