feat(front): add Navbar component and update layout with background image

This commit is contained in:
keven1024
2025-04-12 16:21:42 +08:00
parent 8659fee06f
commit af6fbd2c77
3 changed files with 37 additions and 2 deletions

View File

@@ -0,0 +1,30 @@
<template>
<div class="flex flex-row bg-white/10 backdrop-blur-xl p-2 rounded-full">
<div v-for="item in routes" :key="item.key"
:class="cx('flex flex-row text-sm px-4 py-2 font-bold rounded-full cursor-pointer',
item?.key === type && 'bg-black/10'
)"
@click="()=>{
router.push({
query: {
...route.query,
type: item.key
}
})
}"
>
{{ item.name }}
</div>
</div>
</template>
<script setup lang="ts">
import { cx } from 'class-variance-authority'
const routes = [
{ name: '文件', key: 'file' },
{ name: '文本', key: 'text' }
]
const route = useRoute()
const router = useRouter()
const type = computed(() => route?.query?.type)
</script>

View File

@@ -1,5 +1,9 @@
<template>
<div>
<slot />
<div class="h-screen w-screen">
<img class="w-full h-full object-cover absolute inset-0 -z-[1]" src="https://fuwari.vercel.app/_astro/demo-banner.DFyx781H_Z1gN7UP.webp" />
<div class=" h-full w-full flex flex-col items-center p-10">
<Navbar />
<slot />
</div>
</div>
</template>

View File

@@ -10,6 +10,7 @@
"postinstall": "nuxt prepare"
},
"dependencies": {
"class-variance-authority": "^0.7.1",
"nuxt": "^3.16.0",
"vue": "latest",
"vue-router": "latest"