2024-04-07 03:24:13 +08:00
|
|
|
<script setup lang="ts">
|
2024-07-14 13:38:25 +08:00
|
|
|
import {computed, ref} from 'vue'
|
2024-06-26 13:52:04 +08:00
|
|
|
import ItemCard from './ResItemCard.vue'
|
2024-07-14 23:50:31 +08:00
|
|
|
import * as url from "node:url";
|
2024-04-07 03:24:13 +08:00
|
|
|
|
|
|
|
// 从public/assets/resources.json加载插件
|
2024-07-14 13:38:25 +08:00
|
|
|
let filteredItems = computed(() => {
|
|
|
|
if (!search.value) {
|
|
|
|
return items.value
|
|
|
|
}
|
|
|
|
return items.value.filter(item =>
|
|
|
|
item.name.toLowerCase().includes(search.value.toLowerCase()) ||
|
|
|
|
item.description.toLowerCase().includes(search.value.toLowerCase()) ||
|
|
|
|
item.author.toLowerCase().includes(search.value.toLowerCase())
|
|
|
|
)
|
|
|
|
})
|
|
|
|
// 插件商店Nonebot
|
2024-04-07 03:24:13 +08:00
|
|
|
let items = ref([])
|
2024-07-14 13:38:25 +08:00
|
|
|
let search = ref('')
|
2024-07-14 23:50:31 +08:00
|
|
|
fetch("https://bot.liteyuki.icu/assets/resources.json")
|
2024-04-07 03:24:13 +08:00
|
|
|
.then(response => response.json())
|
|
|
|
.then(data => {
|
|
|
|
items.value = data
|
|
|
|
})
|
|
|
|
.catch(error => console.error(error))
|
|
|
|
|
|
|
|
</script>
|
|
|
|
|
|
|
|
<template>
|
|
|
|
<div>
|
|
|
|
<h1>主题/资源商店</h1>
|
2024-07-14 13:38:25 +08:00
|
|
|
<input class="item-search-box" type="text" placeholder="搜索资源" v-model="search" />
|
2024-04-07 03:24:13 +08:00
|
|
|
<div class="market">
|
2024-07-14 13:38:25 +08:00
|
|
|
<!-- 使用filteredItems来布局商品 -->
|
|
|
|
<ItemCard v-for="item in filteredItems" :key="item.id" :item="item"/>
|
2024-04-07 03:24:13 +08:00
|
|
|
</div>
|
|
|
|
</div>
|
|
|
|
</template>
|
|
|
|
|
|
|
|
<style scoped>
|
|
|
|
h1 {
|
|
|
|
color: #00a6ff;
|
|
|
|
text-align: center;
|
|
|
|
font-weight: bold;
|
|
|
|
}
|
|
|
|
|
|
|
|
.market {
|
|
|
|
display: grid;
|
|
|
|
grid-template-columns: repeat(auto-fill, minmax(260px, 1fr));
|
|
|
|
gap: 10px;
|
|
|
|
}
|
|
|
|
</style>
|