mirror of
https://github.com/TriM-Organization/LiteyukiBot-TriM.git
synced 2024-11-28 16:24:51 +08:00
✨ 插件商店及资源商店新增搜索功能
This commit is contained in:
parent
605dd035d4
commit
c36a925bb5
@ -1,25 +1,48 @@
|
|||||||
<script setup lang="ts">
|
<script setup lang="ts">
|
||||||
import {ref} from 'vue'
|
import {computed, ref} from 'vue'
|
||||||
import ItemCard from './PluginItemCard.vue'
|
import ItemCard from './PluginItemCard.vue'
|
||||||
|
|
||||||
|
|
||||||
|
let filteredItems = computed(() => {
|
||||||
|
if (!search.value) {
|
||||||
|
return items.value
|
||||||
|
}
|
||||||
|
return items.value.filter(item =>
|
||||||
|
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())
|
||||||
|
)
|
||||||
|
})
|
||||||
// 插件商店Nonebot
|
// 插件商店Nonebot
|
||||||
let items = ref([])
|
let items = ref([])
|
||||||
fetch('https://registry.nonebot.dev/plugins.json')
|
let search = ref('')
|
||||||
|
// 从官方拉取
|
||||||
|
fetch('/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')
|
||||||
|
.then(response => response.json())
|
||||||
|
.then(data => {
|
||||||
|
items.value = items.value.concat(data)
|
||||||
|
})
|
||||||
|
|
||||||
|
|
||||||
</script>
|
</script>
|
||||||
|
|
||||||
<template>
|
<template>
|
||||||
<div>
|
<div>
|
||||||
<h1>插件商店</h1>
|
<h1>插件商店</h1>
|
||||||
<p>所有内容来自<a href="https://nonebot.dev/store/plugins">NoneBot插件商店</a>,在此仅作引用,具体请访问NoneBot插件商店</p>
|
<p>内容来自<a href="https://nonebot.dev/store/plugins">NoneBot插件商店</a>和轻雪商店,在此仅作引用,具体请访问NoneBot插件商店</p>
|
||||||
|
<!-- 搜索框-->
|
||||||
|
<input class="item-search-box" type="text" placeholder="搜索插件" v-model="search"/>
|
||||||
<div class="market">
|
<div class="market">
|
||||||
<!-- 布局商品-->
|
<!-- 使用filteredItems来布局商品 -->
|
||||||
<ItemCard v-for="item in items" :key="item.id" :item="item"/>
|
<ItemCard v-for="item in filteredItems" :key="item.id" :item="item"/>
|
||||||
</div>
|
</div>
|
||||||
</div>
|
</div>
|
||||||
</template>
|
</template>
|
||||||
|
@ -1,14 +1,25 @@
|
|||||||
<script setup lang="ts">
|
<script setup lang="ts">
|
||||||
import {ref} from 'vue'
|
import {computed, ref} from 'vue'
|
||||||
import ItemCard from './ResItemCard.vue'
|
import ItemCard from './ResItemCard.vue'
|
||||||
|
|
||||||
// 从public/assets/resources.json加载插件
|
// 从public/assets/resources.json加载插件
|
||||||
|
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
|
||||||
let items = ref([])
|
let items = ref([])
|
||||||
|
let search = ref('')
|
||||||
fetch('/assets/resources.json')
|
fetch('/assets/resources.json')
|
||||||
.then(response => response.json())
|
.then(response => response.json())
|
||||||
.then(data => {
|
.then(data => {
|
||||||
items.value = data
|
items.value = data
|
||||||
|
|
||||||
})
|
})
|
||||||
.catch(error => console.error(error))
|
.catch(error => console.error(error))
|
||||||
|
|
||||||
@ -17,9 +28,14 @@ fetch('/assets/resources.json')
|
|||||||
<template>
|
<template>
|
||||||
<div>
|
<div>
|
||||||
<h1>主题/资源商店</h1>
|
<h1>主题/资源商店</h1>
|
||||||
|
<!-- <div class="market">-->
|
||||||
|
<!--<!– 布局商品–>-->
|
||||||
|
<!-- <ItemCard v-for="item in [...items].reverse()" :key="item.id" :item="item" />-->
|
||||||
|
<!-- </div>-->
|
||||||
|
<input class="item-search-box" type="text" placeholder="搜索资源" v-model="search" />
|
||||||
<div class="market">
|
<div class="market">
|
||||||
<!-- 布局商品-->
|
<!-- 使用filteredItems来布局商品 -->
|
||||||
<ItemCard v-for="item in [...items].reverse()" :key="item.id" :item="item" />
|
<ItemCard v-for="item in filteredItems" :key="item.id" :item="item"/>
|
||||||
</div>
|
</div>
|
||||||
</div>
|
</div>
|
||||||
</template>
|
</template>
|
||||||
|
23
docs/.vuepress/public/assets/plugins.json
Normal file
23
docs/.vuepress/public/assets/plugins.json
Normal file
@ -0,0 +1,23 @@
|
|||||||
|
[
|
||||||
|
{
|
||||||
|
"module_name": "nonebot_plugin_status",
|
||||||
|
"project_link": "nonebot-plugin-status",
|
||||||
|
"name": "测试",
|
||||||
|
"desc": "测试",
|
||||||
|
"author": "snowykami",
|
||||||
|
"homepage": "https://github.com/nonebot/plugin-status",
|
||||||
|
"tags": [
|
||||||
|
{
|
||||||
|
"label": "server",
|
||||||
|
"color": "#aeeaa8"
|
||||||
|
}
|
||||||
|
],
|
||||||
|
"is_official": true,
|
||||||
|
"type": "application",
|
||||||
|
"supported_adapters": null,
|
||||||
|
"valid": true,
|
||||||
|
"version": "0.8.1",
|
||||||
|
"time": "2024-03-04T06:57:10.250823Z",
|
||||||
|
"skip_test": false
|
||||||
|
}
|
||||||
|
]
|
@ -36,6 +36,7 @@ code {
|
|||||||
border-radius: 6px;
|
border-radius: 6px;
|
||||||
line-height: 1.375;
|
line-height: 1.375;
|
||||||
}
|
}
|
||||||
|
|
||||||
// 移除该before
|
// 移除该before
|
||||||
.theme-hope-content pre::before {
|
.theme-hope-content pre::before {
|
||||||
content: none;
|
content: none;
|
||||||
@ -74,8 +75,16 @@ code {
|
|||||||
aspect-ratio: 1/1;
|
aspect-ratio: 1/1;
|
||||||
}
|
}
|
||||||
|
|
||||||
.tab-title{
|
.tab-title {
|
||||||
text-align: center;
|
text-align: center;
|
||||||
justify-content: center;
|
justify-content: center;
|
||||||
flex: 1;
|
flex: 1;
|
||||||
}
|
}
|
||||||
|
|
||||||
|
.item-search-box {
|
||||||
|
border-radius: 100px;
|
||||||
|
width: 100%;
|
||||||
|
padding: 10px;
|
||||||
|
margin: 10px 0;
|
||||||
|
border: 1px solid #ccc;
|
||||||
|
}
|
Loading…
Reference in New Issue
Block a user