提交 932228ba 编写于 作者: View Design's avatar View Design

调整移动端菜单

上级 630264bf
...@@ -27,7 +27,6 @@ ...@@ -27,7 +27,6 @@
size="xs" size="xs"
long long
:to="`/search/${item.c_id}`" :to="`/search/${item.c_id}`"
@click="handleClickItem"
> >
<div class="flex-grow truncate">{{ item.title }}</div> <div class="flex-grow truncate">{{ item.title }}</div>
<UButton <UButton
...@@ -89,7 +88,6 @@ ...@@ -89,7 +88,6 @@
<script setup> <script setup>
import { IConfirm } from '#components' import { IConfirm } from '#components'
const emits = defineEmits(['sign', 'clear']) const emits = defineEmits(['sign', 'clear'])
const Layout = inject('Layout')
const modal = useModal() const modal = useModal()
const { $isSignIn } = storeToRefs(useUserStore()) const { $isSignIn } = storeToRefs(useUserStore())
const { $searchHistory } = storeToRefs(useSearchStore()) const { $searchHistory } = storeToRefs(useSearchStore())
...@@ -135,10 +133,6 @@ function handleOpen () { ...@@ -135,10 +133,6 @@ function handleOpen () {
function handleClose () { function handleClose () {
isOpenHistory.value = false isOpenHistory.value = false
} }
function handleClickItem () {
Layout.handleCloseAside()
}
nextTick(() => { nextTick(() => {
$getSearchHistory() $getSearchHistory()
}) })
......
<template>
<div class="flex md:hidden">
<UButton
class="z-20"
:class="{ 'fixed top-2 left-2' : fixed }"
color="white"
trailing-icon="i-heroicons-bars-3-20-solid"
@click="handleToggleAside"
/>
<USlideover
class="w-64"
v-model="isOpenAside"
side="left"
:overlay="false"
>
<UButton
class="absolute top-2 right-2 z-20"
color="white"
trailing-icon="i-heroicons-x-mark-20-solid"
@click="handleToggleAside"
/>
<IAside />
</USlideover>
</div>
</template>
<script setup>
defineProps({
fixed: {
type: Boolean,
default: false
}
})
const isOpenAside = ref(false)
function handleToggleAside () {
isOpenAside.value = !isOpenAside.value
}
</script>
\ No newline at end of file
...@@ -7,7 +7,6 @@ ...@@ -7,7 +7,6 @@
size="md" size="md"
label="首页" label="首页"
to="/" to="/"
@click="handleClickItem"
/> />
<UButton <UButton
leading-icon="i-heroicons-rectangle-stack" leading-icon="i-heroicons-rectangle-stack"
...@@ -16,7 +15,6 @@ ...@@ -16,7 +15,6 @@
size="md" size="md"
label="主题" label="主题"
to="/library" to="/library"
@click="handleClickItem"
/> />
<ISearchHistory @sign="$openSign" /> <ISearchHistory @sign="$openSign" />
<ClientOnly> <ClientOnly>
...@@ -36,8 +34,4 @@ ...@@ -36,8 +34,4 @@
<script setup> <script setup>
const { $isSignIn, $isOpenSign } = storeToRefs(useUserStore()) const { $isSignIn, $isOpenSign } = storeToRefs(useUserStore())
const { $openSign, $closeSign } = useUserStore() const { $openSign, $closeSign } = useUserStore()
const Layout = inject('Layout')
function handleClickItem () {
Layout.handleCloseAside()
}
</script> </script>
...@@ -27,7 +27,6 @@ ...@@ -27,7 +27,6 @@
size="xs" size="xs"
long long
:to="`/search/${item.c_id}`" :to="`/search/${item.c_id}`"
@click="handleClickItem"
> >
<div class="flex-grow truncate" :title="item.title">{{ item.title }}</div> <div class="flex-grow truncate" :title="item.title">{{ item.title }}</div>
</UButton> </UButton>
...@@ -38,7 +37,6 @@ ...@@ -38,7 +37,6 @@
</template> </template>
<script setup> <script setup>
const emits = defineEmits(['sign', 'clear']) const emits = defineEmits(['sign', 'clear'])
const Layout = inject('Layout')
const modal = useModal() const modal = useModal()
const { $searchHistory } = storeToRefs(useSearchStore()) const { $searchHistory } = storeToRefs(useSearchStore())
const { $clearSearchHistory } = useSearchStore() const { $clearSearchHistory } = useSearchStore()
...@@ -46,7 +44,4 @@ const query = ref('') ...@@ -46,7 +44,4 @@ const query = ref('')
function handleClear () { function handleClear () {
$clearSearchHistory() $clearSearchHistory()
} }
function handleClickItem () {
Layout.handleCloseAside()
}
</script> </script>
...@@ -3,6 +3,7 @@ ...@@ -3,6 +3,7 @@
<div class="container max-w-screen-lg 2xl:max-w-screen-xl flex flex-col p-6"> <div class="container max-w-screen-lg 2xl:max-w-screen-xl flex flex-col p-6">
<div class="flex justify-between items-center"> <div class="flex justify-between items-center">
<div class="flex gap-4"> <div class="flex gap-4">
<IMenuSider />
<div class="flex items-center text-xl gap-2" v-if="!collect"> <div class="flex items-center text-xl gap-2" v-if="!collect">
<UIcon name="i-heroicons-rectangle-stack-20-solid" /> <UIcon name="i-heroicons-rectangle-stack-20-solid" />
<div>主题</div> <div>主题</div>
......
<template> <template>
<header class="sticky top-0 z-10 bg-white dark:bg-black w-full flex flex-col"> <header class="sticky top-0 z-10 bg-white dark:bg-black w-full flex flex-col">
<div class="w-full p-2 justify-end sm:justify-between items-center flex"> <div class="w-full p-2 justify-end sm:justify-between items-center flex">
<IMenuSider />
<div class="hidden md:flex"> <div class="hidden md:flex">
<div class="flex items-center gap-2" v-if="repo"> <div class="flex items-center gap-2" v-if="repo">
<UIcon name="i-simple-icons-github" />{{ repo }} <UIcon name="i-simple-icons-github" />{{ repo }}
......
...@@ -7,41 +7,12 @@ ...@@ -7,41 +7,12 @@
<slot /> <slot />
</div> </div>
</div> </div>
<div class="flex md:hidden">
<UButton
class="fixed top-2 left-2 z-20"
color="white"
trailing-icon="i-heroicons-bars-3-20-solid"
@click="handleToggleAside"
/>
<USlideover
class="w-64"
v-model="isOpenAside"
side="left"
:overlay="false"
>
<UButton
class="absolute top-2 right-2 z-20"
color="white"
trailing-icon="i-heroicons-x-mark-20-solid"
@click="handleToggleAside"
/>
<IAside />
</USlideover>
</div>
<ILibraryCreate /> <ILibraryCreate />
<ILibrarySelect @success="handleCollectSuccess" /> <ILibrarySelect @success="handleCollectSuccess" />
</template> </template>
<script setup> <script setup>
const isOpenAside = ref(false)
const selectCollectData = ref(null) const selectCollectData = ref(null)
const removeCollectData = ref(null) const removeCollectData = ref(null)
function handleToggleAside () {
isOpenAside.value = !isOpenAside.value
}
function handleCloseAside () {
isOpenAside.value = false
}
function handleCollectSuccess (data) { function handleCollectSuccess (data) {
selectCollectData.value = data selectCollectData.value = data
} }
...@@ -55,7 +26,6 @@ function handleClearRemoveCollectData () { ...@@ -55,7 +26,6 @@ function handleClearRemoveCollectData () {
removeCollectData.value = null removeCollectData.value = null
} }
provide('Layout', { provide('Layout', {
handleCloseAside,
selectCollectData, selectCollectData,
handleClearCollectData, handleClearCollectData,
removeCollectData, removeCollectData,
......
...@@ -18,6 +18,7 @@ ...@@ -18,6 +18,7 @@
</template> </template>
</div> </div>
</div> </div>
<IMenuSider fixed />
</template> </template>
<script setup> <script setup>
const recommendQuestions = [ const recommendQuestions = [
......
Markdown is supported
0% .
You are about to add 0 people to the discussion. Proceed with caution.
先完成此消息的编辑!
想要评论请 注册