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

shou'ye

上级 fec531f9
......@@ -111,6 +111,13 @@ const handleSearch = async () => {
navigateTo(`/search/${data.value.data.c_id}`)
emits('search')
}
function handleQuickSearch (title) {
query.value = title
handleSearch()
}
defineExpose({
handleQuickSearch
})
function handleClearRepo () {
selectedRepo.value = ''
}
......
<template>
<div class="flex justify-center">
<NuxtLink to="/" class="font-mono text-2xl font-medium">GitBot.AI</NuxtLink>
<NuxtLink to="/" class="font-mono text-2xl font-medium">GitBot.<span class="text-primary">AI</span></NuxtLink>
</div>
</template>
\ No newline at end of file
......@@ -29,7 +29,7 @@
:to="`/search/${item.c_id}`"
@click="handleClickItem"
>
<div class="flex-grow truncate">{{ item.title }}</div>
<div class="flex-grow truncate" :title="item.title">{{ item.title }}</div>
</UButton>
</template>
</div>
......
......@@ -2,6 +2,43 @@
<div class="flex flex-col items-center justify-center w-full h-full">
<ILogo />
<div class="mt-2">开源搜索,直达结果</div>
<ICreate />
<ICreate ref="refCreate" />
<div class="max-w-screen-md w-full p-6 grid grid-cols-1 lg:grid-cols-2 gap-4">
<template v-for="(item, index) in recommendQuestions" :key="index">
<UButton
class="flex justify-between"
color="gray"
:variant="colorMode.value === 'dark' ? 'solid' : 'soft'"
size="md"
:trailing-icon="item.c_id ? 'i-heroicons-chevron-right-20-solid' : 'i-heroicons-plus-20-solid'"
:label="item.title"
:to="item.c_id ? `/search/${item.c_id}` : ''"
@click="handleSearch(item)"
/>
</template>
</div>
</div>
</template>
<script setup>
const colorMode = useColorMode()
const recommendQuestions = [
{
title: '如何解决 CORS 问题',
c_id: 'c_CawfQuhqPxGy1Ny9'
},
{
title: 'Tailwind CSS 响应式设计指南',
c_id: 'c_1iVipFddPrGXDioC'
},
{
title: '有哪些有效的方法可以应对 DDoS 攻击?'
},
{
title: '如何防止网站被爬'
}
]
const refCreate = ref(null)
function handleSearch (item) {
if (!item.c_id) refCreate.value.handleQuickSearch(item.title)
}
</script>
\ No newline at end of file
Markdown is supported
0% .
You are about to add 0 people to the discussion. Proceed with caution.
先完成此消息的编辑!
想要评论请 注册