mirror of
https://github.com/jxxghp/MoviePilot-Frontend.git
synced 2026-05-24 09:49:42 +08:00
fix
This commit is contained in:
@@ -2,6 +2,7 @@
|
||||
import { useToast } from 'vue-toast-notification'
|
||||
import api from '@/api'
|
||||
import type { Plugin } from '@/api/types'
|
||||
import FormRender from '@/components/render/FormRender.vue'
|
||||
|
||||
// 输入参数
|
||||
const props = defineProps({
|
||||
@@ -56,7 +57,7 @@ async function uninstallPlugin() {
|
||||
// 调用API读取表单页面
|
||||
async function loadPluginForm() {
|
||||
try {
|
||||
const result: { [key: string]: any } = await api.get(`plugin/form/${props.plugin?.id}`)
|
||||
const result: { [key: string]: any } = await api.get(`plugin/form/${props.plugin?.id}`)
|
||||
if (result) {
|
||||
pluginFormItems.value = result.conf
|
||||
pluginConfigForm.value = result.model
|
||||
@@ -110,6 +111,7 @@ async function savePluginConf() {
|
||||
|
||||
// 显示插件详情
|
||||
function showPluginInfo() {
|
||||
pluginConfigDialog.value = false
|
||||
pluginInfoDialog.value = true
|
||||
}
|
||||
|
||||
@@ -220,7 +222,9 @@ const dropdownItems = ref([
|
||||
scrollable
|
||||
>
|
||||
<VCard :title="`插件 - ${props.plugin?.plugin_name}`">
|
||||
<VCardText />
|
||||
<VCardText>
|
||||
<FormRender v-for="(item, index) in pluginFormItems" :key="index" :config="item" />
|
||||
</VCardText>
|
||||
<VCardActions>
|
||||
<VSpacer />
|
||||
<VBtn @click="pluginInfoDialog = false">
|
||||
|
||||
25
src/components/render/FormRender.vue
Normal file
25
src/components/render/FormRender.vue
Normal file
@@ -0,0 +1,25 @@
|
||||
<script lang="ts" setup>
|
||||
import type { PropType } from 'vue'
|
||||
|
||||
interface RenderProps {
|
||||
component: string
|
||||
content: any
|
||||
}
|
||||
|
||||
// 输入参数
|
||||
const props = defineProps({
|
||||
config: Array as PropType<RenderProps[]>,
|
||||
})
|
||||
|
||||
// 配置表单
|
||||
const formItems = ref(props.config)
|
||||
</script>
|
||||
|
||||
<template>
|
||||
<Component :is="item.component" v-for="(item, index) in formItems" :key="index" v-bind="$attrs">
|
||||
<template v-for="(innerItem, innerIndex) in item.content" :key="innerIndex">
|
||||
<FormRender v-if="innerItem.component" :config="innerItem" v-bind="$attrs" />
|
||||
<Component :is="innerItem.component" v-else v-bind="innerItem" />
|
||||
</template>
|
||||
</Component>
|
||||
</template>
|
||||
@@ -20,7 +20,7 @@ const used = ref(0)
|
||||
|
||||
// 计算已使用存储空间百分比,精确到小数点后1位
|
||||
const usedPercent = computed(() => {
|
||||
return Math.round((used.value / storage.value) * 1000) / 10
|
||||
return Math.round((used.value / (storage.value || 1)) * 1000) / 10
|
||||
})
|
||||
|
||||
// 调用API,查询存储空间
|
||||
|
||||
Reference in New Issue
Block a user