Block Editor 重构入口文件
This commit is contained in:
parent
679062422d
commit
a83ba51292
@ -1,9 +1,9 @@
|
||||
<script setup lang="ts">
|
||||
/**
|
||||
* index.vue — Block Editor 主入口 Orchestrator
|
||||
* BlockEditorEntry.vue — Block Editor 主入口 Orchestrator
|
||||
*
|
||||
* 纯编排层,仅组合 composables + 子组件。
|
||||
* 从原 1383 行精简至 ~200 行。
|
||||
* FieldRenderer 经由 controls/BlockEditor.vue 动态导入此文件。
|
||||
*/
|
||||
|
||||
import { ref, computed, shallowRef, onMounted, onBeforeUnmount } from 'vue'
|
||||
@ -315,7 +315,6 @@ function toggleBubbleHeading() {
|
||||
</template>
|
||||
|
||||
|
||||
|
||||
<style>
|
||||
@import './BlockEditor.css';
|
||||
</style>
|
||||
@ -1,52 +0,0 @@
|
||||
<script setup lang="ts">
|
||||
/**
|
||||
* BlockEditorShell.vue — 向后兼容薄壳
|
||||
*
|
||||
* 适配 FieldRenderer 的 Props/Emit 接口,
|
||||
* 透传到 index.vue(内部接口)。
|
||||
*
|
||||
* 当 index.vue 内部接口变化时,仅需修改此文件适配层。
|
||||
* FieldRenderer.vue 零改动。
|
||||
*/
|
||||
|
||||
import BlockEditorIndex from './index.vue'
|
||||
|
||||
interface Df {
|
||||
fieldname: string
|
||||
fieldtype: string
|
||||
label?: string
|
||||
description?: string
|
||||
placeholder?: string
|
||||
[key: string]: any
|
||||
}
|
||||
|
||||
const props = withDefaults(
|
||||
defineProps<{
|
||||
df: Df
|
||||
modelValue?: any
|
||||
disabled?: boolean
|
||||
record?: Record<string, any>
|
||||
canEdit?: boolean
|
||||
ctx?: any
|
||||
}>(),
|
||||
{ canEdit: true },
|
||||
)
|
||||
|
||||
const emit = defineEmits<{
|
||||
(e: 'update:modelValue', v: any): void
|
||||
(e: 'onSave'): void
|
||||
}>()
|
||||
</script>
|
||||
|
||||
<template>
|
||||
<BlockEditorIndex
|
||||
:df="df"
|
||||
:model-value="modelValue"
|
||||
:disabled="disabled"
|
||||
:record="record"
|
||||
:can-edit="canEdit"
|
||||
:ctx="ctx"
|
||||
@update:model-value="emit('update:modelValue', $event)"
|
||||
@on-save="emit('onSave')"
|
||||
/>
|
||||
</template>
|
||||
@ -4,7 +4,7 @@ BlockEditor.vue — 向后兼容重定向
|
||||
此文件仅做重定向,FieldRenderer.vue 无需任何改动。
|
||||
-->
|
||||
<script setup lang="ts">
|
||||
import BlockEditorShell from '@/core/features/block_editor/BlockEditorShell.vue'
|
||||
import BlockEditorEntry from '@/core/features/block_editor/BlockEditorEntry.vue'
|
||||
|
||||
interface Df {
|
||||
fieldname: string
|
||||
@ -34,7 +34,7 @@ const emit = defineEmits<{
|
||||
</script>
|
||||
|
||||
<template>
|
||||
<BlockEditorShell
|
||||
<BlockEditorEntry
|
||||
:df="df"
|
||||
:model-value="modelValue"
|
||||
:disabled="disabled"
|
||||
|
||||
Loading…
x
Reference in New Issue
Block a user