mirror of
https://github.com/jxxghp/MoviePilot-Frontend.git
synced 2026-05-24 17:59:40 +08:00
plugin page render
This commit is contained in:
@@ -3,6 +3,7 @@ import { useToast } from 'vue-toast-notification'
|
||||
import api from '@/api'
|
||||
import type { Plugin } from '@/api/types'
|
||||
import FormRender from '@/components/render/FormRender.vue'
|
||||
import PageRender from '@/components/render/PageRender.vue'
|
||||
import { isNullOrEmptyObject } from '@core/utils'
|
||||
|
||||
// 输入参数
|
||||
@@ -112,7 +113,7 @@ async function savePluginConf() {
|
||||
}
|
||||
|
||||
// 显示插件详情
|
||||
function showPluginInfo() {
|
||||
async function showPluginInfo() {
|
||||
pluginConfigDialog.value = false
|
||||
pluginInfoDialog.value = true
|
||||
}
|
||||
@@ -140,7 +141,7 @@ const dropdownItems = ref([
|
||||
onBeforeMount(async () => {
|
||||
await loadPluginForm()
|
||||
await loadPluginConf()
|
||||
await loadPluginPage()
|
||||
loadPluginPage()
|
||||
})
|
||||
</script>
|
||||
|
||||
@@ -205,7 +206,7 @@ onBeforeMount(async () => {
|
||||
scrollable
|
||||
persistent
|
||||
>
|
||||
<VCard :title="`插件 - ${props.plugin?.plugin_name}`">
|
||||
<VCard :title="props.plugin?.plugin_name">
|
||||
<DialogCloseBtn @click="pluginConfigDialog = false" />
|
||||
<VCardText>
|
||||
<FormRender
|
||||
@@ -234,9 +235,16 @@ onBeforeMount(async () => {
|
||||
scrollable
|
||||
persistent
|
||||
>
|
||||
<VCard :title="`插件 - ${props.plugin?.plugin_name}`">
|
||||
<VCard :title="`${props.plugin?.plugin_name} - 详情`">
|
||||
<DialogCloseBtn @click="pluginInfoDialog = false" />
|
||||
<VCardText />
|
||||
<VCardText>
|
||||
<PageRender
|
||||
v-for="(item, index) in pluginPageItems"
|
||||
:key="index"
|
||||
:config="item"
|
||||
:handler="pluginInfoDialog"
|
||||
/>
|
||||
</VCardText>
|
||||
<VCardActions>
|
||||
<VSpacer />
|
||||
<VBtn @click="pluginInfoDialog = false">
|
||||
|
||||
@@ -4,6 +4,7 @@ import { type PropType, ref } from 'vue'
|
||||
// 组件接口
|
||||
interface RenderProps {
|
||||
component: string
|
||||
text: string
|
||||
content?: any
|
||||
props?: any
|
||||
}
|
||||
@@ -17,6 +18,7 @@ const elementProps = defineProps({
|
||||
// 配置元素
|
||||
const formItem = ref<RenderProps>(elementProps.config || {
|
||||
component: 'div',
|
||||
text: '',
|
||||
props: {},
|
||||
content: [],
|
||||
})
|
||||
@@ -31,6 +33,7 @@ const formData = ref<any>(elementProps.form || {})
|
||||
v-bind="formItem.props"
|
||||
v-model="formData[formItem.props?.model || '']"
|
||||
>
|
||||
{{ formItem.text }}
|
||||
<FormRender
|
||||
v-for="(innerItem, innerIndex) in (formItem.content || [])"
|
||||
:key="innerIndex"
|
||||
|
||||
39
src/components/render/PageRender.vue
Normal file
39
src/components/render/PageRender.vue
Normal file
@@ -0,0 +1,39 @@
|
||||
<script lang="ts" setup>
|
||||
import { type PropType, ref } from 'vue'
|
||||
|
||||
// 组件接口
|
||||
interface RenderProps {
|
||||
component: string
|
||||
text: string
|
||||
content?: any
|
||||
props?: any
|
||||
}
|
||||
|
||||
// 输入参数
|
||||
const elementProps = defineProps({
|
||||
config: Object as PropType<RenderProps>,
|
||||
handler: Boolean,
|
||||
})
|
||||
|
||||
// 配置元素
|
||||
const formItem = ref<RenderProps>(elementProps.config || {
|
||||
component: 'div',
|
||||
text: '',
|
||||
props: {},
|
||||
content: [],
|
||||
})
|
||||
</script>
|
||||
|
||||
<template>
|
||||
<Component
|
||||
:is="formItem.component"
|
||||
v-bind="formItem.props"
|
||||
>
|
||||
{{ formItem.text }}
|
||||
<PageRender
|
||||
v-for="(innerItem, innerIndex) in (formItem.content || [])"
|
||||
:key="innerIndex"
|
||||
:config="innerItem"
|
||||
/>
|
||||
</Component>
|
||||
</template>
|
||||
Reference in New Issue
Block a user