plugin statistic

This commit is contained in:
jxxghp
2024-03-25 18:31:55 +08:00
parent 4d8f369ba0
commit 74dd549ffb
2 changed files with 30 additions and 8 deletions

View File

@@ -21,6 +21,9 @@ const isAppMarketLoaded = ref(false)
// APP市场窗口
const PluginAppDialog = ref(false)
// 插件安装统计
const PluginStatistics = ref<{ [key: string]: number }>({})
// 延迟加载
let defer = (_: number) => true
@@ -76,6 +79,16 @@ async function fetchUninstalledPlugins() {
}
}
// 加载插件统计数据
async function getPluginStatistics() {
try {
PluginStatistics.value = await api.get('plugin/statistic')
}
catch (error) {
console.error(error)
}
}
// 加载所有数据
function refreshData() {
fetchInstalledPlugins()
@@ -92,6 +105,7 @@ const getUnupdatedPlugins = computed(() => {
// 加载时获取数据
onBeforeMount(() => {
refreshData()
getPluginStatistics()
})
</script>
@@ -187,6 +201,7 @@ onBeforeMount(() => {
v-if="defer(index)"
:key="data.id"
:plugin="data"
:count="PluginStatistics[data.id || '0']"
@install="pluginInstalled"
/>
</div>