-
Notifications
You must be signed in to change notification settings - Fork 6
Commit
This commit does not belong to any branch on this repository, and may belong to a fork outside of the repository.
- Loading branch information
1 parent
f63d11c
commit f3803ba
Showing
13 changed files
with
165 additions
and
24 deletions.
There are no files selected for viewing
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Original file line number | Diff line number | Diff line change |
---|---|---|
@@ -0,0 +1,83 @@ | ||
<script setup> | ||
const routeData = usePath(useRoute()) | ||
const { data: tagList } = await useFetch(`/api/global/tags?type=${routeData.type}`) | ||
const isFold = useFold(false) | ||
const maxLength = 9 | ||
</script> | ||
|
||
<template> | ||
<Transition name="fade"> | ||
<nav v-if="tagList.length > 0" class="tag-nav tag-navigator"> | ||
<ul class="nav-list tag-list"> | ||
<li class="nav-items tag active"> | ||
<NuxtLink :to="`/${routeData.type}`" class="nav-item"> | ||
综合 | ||
</NuxtLink> | ||
</li> | ||
<li v-for="(item, index) in tagList" :key="item.id" class="nav-items tag " :class="{ '!hidden': (index >= maxLength && !isFold) }"> | ||
<NuxtLink :to="`/${routeData.type}/${item.tag}`" class="nav-item"> | ||
{{ item.alias }} | ||
</NuxtLink> | ||
</li> | ||
<li v-if="!isFold && tagList.length > maxLength" class="nav-items tag unfold" @click="isFold = true"> | ||
展开 | ||
</li> | ||
</ul> | ||
</nav> | ||
</Transition> | ||
</template> | ||
|
||
<style scoped> | ||
.tag-list { | ||
display: flex; | ||
flex-wrap: wrap; | ||
height: auto; | ||
} | ||
.nav-list { | ||
position: relative; | ||
} | ||
.nav-list .nav-items.tag:has(.router-link-exact-active) { | ||
background-color: #007fff; | ||
color: #fff; | ||
box-shadow: 0 1px 2px 0 rgb(0 0 0 / 5%), 0 1px 2px 0 rgb(0 0 0 / 5%); | ||
} | ||
.nav-list .nav-items.tag { | ||
display: flex; | ||
justify-content: center; | ||
align-items: center; | ||
height: 2rem; | ||
background-color: #fff; | ||
border-radius: 1rem; | ||
font-size: 1.1rem; | ||
color: #8a9aa9; | ||
padding: 0 .83rem; | ||
margin-right: 1rem; | ||
margin-bottom: 1rem; | ||
} | ||
.nav-items { | ||
position: relative; | ||
cursor: pointer; | ||
} | ||
.nav-item.router-link-exact-active { | ||
color: #fff; | ||
} | ||
.nav-item { | ||
text-decoration: none; | ||
cursor: pointer; | ||
color: #909090; | ||
} | ||
.nav-list .nav-items.unfold { | ||
padding-right: 2rem; | ||
} | ||
.nav-list .nav-items.unfold:after { | ||
position: absolute; | ||
right: 8px; | ||
bottom: 35%; | ||
content: ""; | ||
height: 5px; | ||
width: 0; | ||
border-left: 5px solid transparent; | ||
border-right: 5px solid transparent; | ||
border-top: 5px solid #8a9aa9; | ||
} | ||
</style> |
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Original file line number | Diff line number | Diff line change |
---|---|---|
@@ -0,0 +1 @@ | ||
export const useFold = (data: boolean) => useState('unfold', () => data) |
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Original file line number | Diff line number | Diff line change |
---|---|---|
@@ -1,5 +1,5 @@ | ||
<script setup> | ||
const route = useRoute() | ||
</script> | ||
|
||
<template> | ||
|
This file was deleted.
Oops, something went wrong.
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Original file line number | Diff line number | Diff line change |
---|---|---|
@@ -0,0 +1,24 @@ | ||
import { useGraphql } from '~~/utils/useGraphql' | ||
import type { ITagItem } from '~~/types/IType' | ||
|
||
export default defineEventHandler(async (event): Promise<ITagItem[]> => { | ||
const query = getQuery(event) | ||
const type = query.type || ''// all、others | ||
const reqQuery = `query { | ||
tags( | ||
filters:{ | ||
type: {type:{eq:"${type}"}} | ||
} | ||
) { | ||
data { | ||
id | ||
attributes { | ||
tag | ||
alias | ||
} | ||
} | ||
} | ||
} | ||
` | ||
return (await useGraphql(reqQuery)).tags.data | ||
}) |