mirror of
https://github.com/Moe-Sakura/frontend.git
synced 2026-05-20 21:45:46 +08:00
Remove friends.json and update SearchHeader.vue to import friend links directly from the new path.
This commit is contained in:
@@ -411,7 +411,7 @@
|
||||
友情链接
|
||||
</h2>
|
||||
<a
|
||||
href="https://github.com/Moe-Sakura/frontend/edit/dev/public/data/friends.json"
|
||||
href="https://github.com/Moe-Sakura/frontend/edit/dev/src/data/friends.json"
|
||||
target="_blank"
|
||||
rel="noopener noreferrer"
|
||||
class="flex items-center gap-1.5 px-3 py-1.5 rounded-full text-xs font-medium
|
||||
@@ -497,24 +497,15 @@ const searchMode = ref<'game' | 'patch'>('game')
|
||||
let cleanupURLListener: (() => void) | null = null
|
||||
|
||||
// 友情链接
|
||||
import friendsData from '@/data/friends.json'
|
||||
|
||||
interface FriendLink {
|
||||
name: string
|
||||
desc: string
|
||||
url: string
|
||||
logo: string
|
||||
}
|
||||
const friendLinks = ref<FriendLink[]>([])
|
||||
|
||||
// 获取友情链接数据
|
||||
async function loadFriendLinks() {
|
||||
try {
|
||||
const res = await fetch('/data/friends.json')
|
||||
const data = await res.json()
|
||||
friendLinks.value = data.friends || []
|
||||
} catch {
|
||||
// 静默失败
|
||||
}
|
||||
}
|
||||
const friendLinks = ref<FriendLink[]>(friendsData.friends || [])
|
||||
|
||||
// 友链 logo 加载失败时的处理
|
||||
function handleFriendLogoError(e: Event) {
|
||||
@@ -566,9 +557,6 @@ onMounted(() => {
|
||||
isUpdatingFromURL = false
|
||||
}, 200)
|
||||
})
|
||||
|
||||
// 加载友情链接
|
||||
loadFriendLinks()
|
||||
})
|
||||
|
||||
onUnmounted(() => {
|
||||
|
||||
40
src/data/friends.json
Normal file
40
src/data/friends.json
Normal file
@@ -0,0 +1,40 @@
|
||||
{
|
||||
"friends": [
|
||||
{
|
||||
"name": "Jurangren",
|
||||
"desc": "本站后端大手子!",
|
||||
"url": "https://github.com/Jurangren",
|
||||
"logo": "https://avatars.githubusercontent.com/u/111159360"
|
||||
},
|
||||
{
|
||||
"name": "Asuna",
|
||||
"desc": "LINK START!",
|
||||
"url": "https://saop.cc/",
|
||||
"logo": "https://saop.cc/avatar.webp"
|
||||
},
|
||||
{
|
||||
"name": "VNDB",
|
||||
"desc": "Visual Novel Database",
|
||||
"url": "https://vndb.org/",
|
||||
"logo": "https://vndb.org/favicon.ico"
|
||||
},
|
||||
{
|
||||
"name": "梓澪",
|
||||
"desc": "梓澪の妙妙屋",
|
||||
"url": "https://zi0.cc/",
|
||||
"logo": "https://img.mjj.today/2023/01/23/2b6331a29bf32d2af96a2537e10a5ee8.webp"
|
||||
},
|
||||
{
|
||||
"name": "VNS",
|
||||
"desc": "Visual Novel",
|
||||
"url": "https://gal.saop.cc",
|
||||
"logo": "https://gal.saop.cc/images/logo.svg"
|
||||
},
|
||||
{
|
||||
"name": "KisuGal",
|
||||
"desc": "galgame资源分享站",
|
||||
"url": "https://kisugal.icu",
|
||||
"logo": "https://kisugal.icu/wp-content/uploads/2025/11/logo-1.jpg"
|
||||
}
|
||||
]
|
||||
}
|
||||
Reference in New Issue
Block a user