diff --git a/src/components/editor/components/ImagePicker.vue b/src/components/editor/components/ImagePicker.vue new file mode 100644 index 0000000..8079942 --- /dev/null +++ b/src/components/editor/components/ImagePicker.vue @@ -0,0 +1,16 @@ + + + + + diff --git a/src/components/editor/config/block.ts b/src/components/editor/config/block.ts new file mode 100644 index 0000000..4123ef4 --- /dev/null +++ b/src/components/editor/config/block.ts @@ -0,0 +1,35 @@ +export interface Block { + id: string; + type: string; + x: number; + y: number; + w: number; + h: number; + xFixed: boolean; + yFixed: boolean; + bgImage?: string; + bgColor?: string; + data: T; + meta: Record; + actived: false, + resizable: boolean, + draggable: boolean, +} + +export const DefaultBlock: Block = { + id: "", + type: "", + x: 0, + y: 0, + w: 50, + h: 50, + xFixed: false, + yFixed: false, + bgImage: "", + bgColor: "", + data: {}, + meta: {}, + actived: false, + resizable: true, + draggable: true, +}; diff --git a/src/components/editor/config/blocker.ts b/src/components/editor/config/blocker.ts new file mode 100644 index 0000000..dbb8d3b --- /dev/null +++ b/src/components/editor/config/blocker.ts @@ -0,0 +1,26 @@ +import { Component } from "vue"; +import { Block } from "./block"; + +interface Blocker { + /** + * 组件默认值 + */ + initial: Block; + /** + * 渲染组件 + */ + render: Component; + /** + * 配置组件 + */ + option: Component; +} + +/** + * 定义组件 + * @param blocker 参数 + * @returns + */ +export const defineBlocker = (blocker: Blocker) => { + return blocker; +}; diff --git a/src/components/editor/config/container.ts b/src/components/editor/config/container.ts new file mode 100644 index 0000000..e4722f3 --- /dev/null +++ b/src/components/editor/config/container.ts @@ -0,0 +1,11 @@ + +export interface Container { + id: number | string; + title: string; + description?: string; + width: number; + height: number; + bgImage?: string; + bgColor?: string; + zoom: number; +} diff --git a/src/components/editor/config/context.ts b/src/components/editor/config/context.ts new file mode 100644 index 0000000..1a3f228 --- /dev/null +++ b/src/components/editor/config/context.ts @@ -0,0 +1,15 @@ +import { InjectionKey, Ref } from "vue"; +import { Block } from "./block"; +import { Container } from "./container"; + +export interface Context { + current: { + block: Block; + }; + blocks: Ref; + container: Ref; + setCurrentBlock: (block: Block) => void; +} + +export const ContextKey = Symbol('ContextKey') as InjectionKey; + diff --git a/src/components/editor/config/index.ts b/src/components/editor/config/index.ts index 4c2558a..8a0cef9 100644 --- a/src/components/editor/config/index.ts +++ b/src/components/editor/config/index.ts @@ -1 +1,4 @@ -export const ContextKey = Symbol('ContextKey'); \ No newline at end of file +export * from './block'; +export * from './blocker'; +export * from './container'; +export * from './context'; \ No newline at end of file diff --git a/src/components/editor/index.vue b/src/components/editor/index.vue index 751e933..941940b 100644 --- a/src/components/editor/index.vue +++ b/src/components/editor/index.vue @@ -20,20 +20,47 @@ diff --git a/src/components/editor/panel-left/index.vue b/src/components/editor/panel-left/index.vue index a9664a5..97bce3a 100644 --- a/src/components/editor/panel-left/index.vue +++ b/src/components/editor/panel-left/index.vue @@ -10,24 +10,12 @@ - Menu 2 - - - - Menu 3 - - - - Menu 4 + 当前组件 -
+
diff --git a/src/components/editor/panel-main/components/block.vue b/src/components/editor/panel-main/components/block.vue new file mode 100644 index 0000000..4f2f196 --- /dev/null +++ b/src/components/editor/panel-main/components/block.vue @@ -0,0 +1,60 @@ + + + + + diff --git a/src/components/editor/panel-main/components/header.vue b/src/components/editor/panel-main/components/header.vue new file mode 100644 index 0000000..6578e8f --- /dev/null +++ b/src/components/editor/panel-main/components/header.vue @@ -0,0 +1,93 @@ + + + + + diff --git a/src/components/editor/panel-main/index.vue b/src/components/editor/panel-main/index.vue index cf44e4f..bb130a5 100644 --- a/src/components/editor/panel-main/index.vue +++ b/src/components/editor/panel-main/index.vue @@ -1,68 +1,21 @@