2024-04-20 04:10:20 +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 './PluginItemCard.vue'
|
2024-08-24 11:57:53 +08:00
|
|
|
|
import ToggleSwitch from "./ToggleSwitch.vue";
|
2024-04-20 04:10:20 +08:00
|
|
|
|
|
2024-08-24 11:57:53 +08:00
|
|
|
|
let showLiteyukiPluginOnly = ref(false)
|
2024-07-14 13:38:25 +08:00
|
|
|
|
let filteredItems = computed(() => {
|
2024-08-24 11:57:53 +08:00
|
|
|
|
let filtered = items.value
|
|
|
|
|
if (search.value) {
|
|
|
|
|
filtered = filtered.filter(item =>
|
2024-07-14 13:38:25 +08:00
|
|
|
|
item.name.toLowerCase().includes(search.value.toLowerCase()) ||
|
|
|
|
|
item.desc.toLowerCase().includes(search.value.toLowerCase()) ||
|
|
|
|
|
item.author.toLowerCase().includes(search.value.toLowerCase()) ||
|
|
|
|
|
item.module_name.toLowerCase().includes(search.value.toLowerCase())
|
2024-08-24 11:57:53 +08:00
|
|
|
|
)
|
|
|
|
|
}
|
|
|
|
|
if (showLiteyukiPluginOnly.value) {
|
|
|
|
|
filtered = filtered.filter(item => item.is_liteyuki_plugin)
|
|
|
|
|
}
|
|
|
|
|
return filtered
|
2024-07-14 13:38:25 +08:00
|
|
|
|
})
|
2024-04-20 04:10:20 +08:00
|
|
|
|
// 插件商店Nonebot
|
|
|
|
|
let items = ref([])
|
2024-07-14 13:38:25 +08:00
|
|
|
|
let search = ref('')
|
|
|
|
|
// 从官方拉取
|
2024-07-15 00:03:22 +08:00
|
|
|
|
fetch("/assets/plugins.json")
|
2024-07-14 23:50:31 +08:00
|
|
|
|
.then(response => response.json())
|
|
|
|
|
.then(data => {
|
2024-08-24 11:57:53 +08:00
|
|
|
|
data.forEach(item => {
|
|
|
|
|
item.is_liteyuki_plugin = true
|
|
|
|
|
})
|
2024-07-14 23:50:31 +08:00
|
|
|
|
items.value = data
|
|
|
|
|
})
|
|
|
|
|
.catch(error => console.error(error))
|
2024-07-14 13:38:25 +08:00
|
|
|
|
|
|
|
|
|
//追加
|
2024-04-20 04:10:20 +08:00
|
|
|
|
fetch('https://registry.nonebot.dev/plugins.json')
|
|
|
|
|
.then(response => response.json())
|
|
|
|
|
.then(data => {
|
2024-08-24 11:57:53 +08:00
|
|
|
|
// 遍历data的每一项,把is_official设为false
|
|
|
|
|
data.forEach(item => {
|
|
|
|
|
item.is_official = false
|
|
|
|
|
})
|
2024-07-14 13:38:25 +08:00
|
|
|
|
items.value = items.value.concat(data)
|
2024-04-20 04:10:20 +08:00
|
|
|
|
})
|
2024-07-14 13:38:25 +08:00
|
|
|
|
|
2024-04-20 04:10:20 +08:00
|
|
|
|
</script>
|
|
|
|
|
|
|
|
|
|
<template>
|
2024-07-15 00:22:52 +08:00
|
|
|
|
<div class="market">
|
2024-04-20 04:10:20 +08:00
|
|
|
|
<h1>插件商店</h1>
|
2024-08-24 11:57:53 +08:00
|
|
|
|
<p>内容来自轻雪商店及<a href="https://nonebot.dev/store/plugins">NoneBot插件商店</a>,轻雪通过nonebot插件实现兼容NoneBot,在此仅作引用,具体请访问NoneBot插件商店</p>
|
2024-07-14 13:38:25 +08:00
|
|
|
|
<!-- 搜索框-->
|
2024-08-24 11:57:53 +08:00
|
|
|
|
<div class="search-box-div">
|
|
|
|
|
<input class="item-search-box" type="text" placeholder="搜索插件" v-model="search"/>
|
|
|
|
|
<ToggleSwitch v-model:modelValue="showLiteyukiPluginOnly" />仅轻雪插件
|
|
|
|
|
</div>
|
2024-07-15 00:22:52 +08:00
|
|
|
|
<div class="items">
|
2024-07-14 13:38:25 +08:00
|
|
|
|
<!-- 使用filteredItems来布局商品 -->
|
|
|
|
|
<ItemCard v-for="item in filteredItems" :key="item.id" :item="item"/>
|
2024-04-20 04:10:20 +08:00
|
|
|
|
</div>
|
|
|
|
|
</div>
|
|
|
|
|
</template>
|
|
|
|
|
|
|
|
|
|
<style scoped>
|
|
|
|
|
h1 {
|
|
|
|
|
color: #00a6ff;
|
|
|
|
|
text-align: center;
|
|
|
|
|
font-weight: bold;
|
|
|
|
|
}
|
|
|
|
|
|
2024-07-15 00:22:52 +08:00
|
|
|
|
.items {
|
2024-04-20 04:10:20 +08:00
|
|
|
|
display: grid;
|
|
|
|
|
grid-template-columns: repeat(auto-fill, minmax(260px, 1fr));
|
|
|
|
|
gap: 10px;
|
|
|
|
|
}
|
2024-08-24 11:57:53 +08:00
|
|
|
|
|
|
|
|
|
.search-box-div {
|
|
|
|
|
display: flex;
|
|
|
|
|
justify-content: center;
|
|
|
|
|
align-items: center;
|
|
|
|
|
margin-bottom: 10px;
|
|
|
|
|
}
|
|
|
|
|
|
|
|
|
|
.search-box-div input {
|
|
|
|
|
margin-right: 10px;
|
|
|
|
|
}
|
2024-04-20 04:10:20 +08:00
|
|
|
|
</style>
|