插件商店及资源商店新增搜索功能

This commit is contained in:
snowy 2024-07-14 23:50:31 +08:00
parent dbc114a529
commit 01e6256ed4
3 changed files with 9 additions and 11 deletions

View File

@ -18,11 +18,12 @@ let filteredItems = computed(() => {
let items = ref([]) let items = ref([])
let search = ref('') let search = ref('')
// //
fetch('assets/plugins.json') fetch("https://bot.liteyuki.icu/assets/plugins.json")
.then(response => response.json()) .then(response => response.json())
.then(data => { .then(data => {
items.value = data items.value = data
}) })
.catch(error => console.error(error))
// //
fetch('https://registry.nonebot.dev/plugins.json') fetch('https://registry.nonebot.dev/plugins.json')

View File

@ -1,6 +1,7 @@
<script setup lang="ts"> <script setup lang="ts">
import {computed, ref} from 'vue' import {computed, ref} from 'vue'
import ItemCard from './ResItemCard.vue' import ItemCard from './ResItemCard.vue'
import * as url from "node:url";
// public/assets/resources.json // public/assets/resources.json
let filteredItems = computed(() => { let filteredItems = computed(() => {
@ -16,7 +17,7 @@ let filteredItems = computed(() => {
// Nonebot // Nonebot
let items = ref([]) let items = ref([])
let search = ref('') let search = ref('')
fetch('/assets/resources.json') fetch("https://bot.liteyuki.icu/assets/resources.json")
.then(response => response.json()) .then(response => response.json())
.then(data => { .then(data => {
items.value = data items.value = data
@ -28,10 +29,6 @@ fetch('/assets/resources.json')
<template> <template>
<div> <div>
<h1>主题/资源商店</h1> <h1>主题/资源商店</h1>
<!-- <div class="market">-->
<!--&lt;!&ndash; 布局商品&ndash;&gt;-->
<!-- <ItemCard v-for="item in [...items].reverse()" :key="item.id" :item="item" />-->
<!-- </div>-->
<input class="item-search-box" type="text" placeholder="搜索资源" v-model="search" /> <input class="item-search-box" type="text" placeholder="搜索资源" v-model="search" />
<div class="market"> <div class="market">
<!-- 使用filteredItems来布局商品 --> <!-- 使用filteredItems来布局商品 -->

View File

@ -8,7 +8,7 @@ export default hopeTheme({
author: { author: {
name: "远野千束", name: "远野千束",
url: "https://snowykami.me", url: "https://sfkm.me",
}, },
iconAssets: "fontawesome-with-brands", iconAssets: "fontawesome-with-brands",