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

update

上级 ec8e7716
...@@ -7,6 +7,7 @@ ...@@ -7,6 +7,7 @@
size="md" size="md"
label="首页" label="首页"
to="/" to="/"
@click="handleClickItem"
/> />
<UButton <UButton
leading-icon="i-heroicons-rectangle-stack" leading-icon="i-heroicons-rectangle-stack"
...@@ -15,6 +16,7 @@ ...@@ -15,6 +16,7 @@
size="md" size="md"
label="收藏夹" label="收藏夹"
to="/library" to="/library"
@click="handleClickItem"
/> />
<ISearchHistory @sign="handleOpenSign" /> <ISearchHistory @sign="handleOpenSign" />
<UButton <UButton
...@@ -31,11 +33,16 @@ ...@@ -31,11 +33,16 @@
</template> </template>
<script setup> <script setup>
const { $isSignIn } = useUserStore() const { $isSignIn } = useUserStore()
const Layout = inject('Layout')
const isOpenSign = ref(false) const isOpenSign = ref(false)
const handleOpenSign = () => { const handleOpenSign = () => {
isOpenSign.value = true isOpenSign.value = true
handleClickItem()
} }
const handleCloseSign = () => { const handleCloseSign = () => {
isOpenSign.value = false isOpenSign.value = false
} }
function handleClickItem () {
Layout.handleToggleAside()
}
</script> </script>
...@@ -24,6 +24,7 @@ ...@@ -24,6 +24,7 @@
variant="ghost" variant="ghost"
size="xs" size="xs"
:to="'/search/' + item.url" :to="'/search/' + item.url"
@click="handleClickItem"
> >
<div class="truncate">{{ item.title }}</div> <div class="truncate">{{ item.title }}</div>
</UButton> </UButton>
...@@ -65,6 +66,7 @@ ...@@ -65,6 +66,7 @@
</template> </template>
<script setup> <script setup>
const emits = defineEmits(['sign', 'clear']) const emits = defineEmits(['sign', 'clear'])
const Layout = inject('Layout')
const { $isSignIn } = useUserStore() const { $isSignIn } = useUserStore()
const searchHistory = ref([ const searchHistory = ref([
{ {
...@@ -98,4 +100,7 @@ function handleOpen () { ...@@ -98,4 +100,7 @@ function handleOpen () {
function handleClose () { function handleClose () {
isOpenHistory.value = false isOpenHistory.value = false
} }
function handleClickItem () {
Layout.handleToggleAside()
}
</script> </script>
...@@ -12,7 +12,7 @@ ...@@ -12,7 +12,7 @@
class="fixed top-2 left-2 z-20" class="fixed top-2 left-2 z-20"
color="white" color="white"
trailing-icon="i-heroicons-bars-3-20-solid" trailing-icon="i-heroicons-bars-3-20-solid"
@click="handleToogleAside" @click="handleToggleAside"
/> />
<USlideover <USlideover
class="w-64" class="w-64"
...@@ -24,7 +24,7 @@ ...@@ -24,7 +24,7 @@
class="absolute top-2 right-2 z-20" class="absolute top-2 right-2 z-20"
color="white" color="white"
trailing-icon="i-heroicons-x-mark-20-solid" trailing-icon="i-heroicons-x-mark-20-solid"
@click="handleToogleAside" @click="handleToggleAside"
/> />
<IAside /> <IAside />
</USlideover> </USlideover>
...@@ -32,7 +32,10 @@ ...@@ -32,7 +32,10 @@
</template> </template>
<script setup> <script setup>
const isOpenAside = ref(false) const isOpenAside = ref(false)
const handleToogleAside = () => { const handleToggleAside = () => {
isOpenAside.value = !isOpenAside.value isOpenAside.value = !isOpenAside.value
} }
provide('Layout', {
handleToggleAside
})
</script> </script>
Markdown is supported
0% .
You are about to add 0 people to the discussion. Proceed with caution.
先完成此消息的编辑!
想要评论请 注册