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

Update SearchHistory.vue

上级 c7150c80
...@@ -10,7 +10,6 @@ ...@@ -10,7 +10,6 @@
label="搜索记录" label="搜索记录"
/> />
<UButton <UButton
v-if="$isSignIn"
class="hidden group-hover:flex" class="hidden group-hover:flex"
label="清空" label="清空"
size="md" size="md"
...@@ -18,28 +17,29 @@ ...@@ -18,28 +17,29 @@
@click="handleClear" @click="handleClear"
/> />
</div> </div>
<div v-if="$isSignIn" class="flex overflow-y-auto flex-col gap-1 border-l border-gray-200 dark:border-gray-800 pl-2 ml-5"> <ClientOnly>
<template v-for="(item, index) in $searchHistory" :key="index"> <div class="flex overflow-y-auto flex-col gap-1 border-l border-gray-200 dark:border-gray-800 pl-2 ml-5">
<UButton <template v-for="(item, index) in $searchHistory" :key="index">
class="flex text-gray-400" <UButton
color="gray" class="flex text-gray-400"
variant="ghost" color="gray"
size="xs" variant="ghost"
long size="xs"
:to="`/search/${item.c_id}`" long
@click="handleClickItem" :to="`/search/${item.c_id}`"
> @click="handleClickItem"
<div class="flex-grow truncate">{{ item.title }}</div> >
</UButton> <div class="flex-grow truncate">{{ item.title }}</div>
</template> </UButton>
</div> </template>
</div>
</ClientOnly>
</div> </div>
</template> </template>
<script setup> <script setup>
const emits = defineEmits(['sign', 'clear']) const emits = defineEmits(['sign', 'clear'])
const Layout = inject('Layout') const Layout = inject('Layout')
const modal = useModal() const modal = useModal()
const { $isSignIn } = storeToRefs(useUserStore())
const { $searchHistory } = storeToRefs(useSearchStore()) const { $searchHistory } = storeToRefs(useSearchStore())
const { $clearSearchHistory } = useSearchStore() const { $clearSearchHistory } = useSearchStore()
const query = ref('') const query = ref('')
......
Markdown is supported
0% .
You are about to add 0 people to the discussion. Proceed with caution.
先完成此消息的编辑!
想要评论请 注册