From a6037022d8410f27831d93ecaba48d7a29bf500a Mon Sep 17 00:00:00 2001 From: unknown Date: Wed, 12 May 2021 17:57:53 +0800 Subject: [PATCH] feat(components): divider --- src/packages/base-widgets/divider/index.tsx | 40 +++++++++++++++++++++ 1 file changed, 40 insertions(+) create mode 100644 src/packages/base-widgets/divider/index.tsx diff --git a/src/packages/base-widgets/divider/index.tsx b/src/packages/base-widgets/divider/index.tsx new file mode 100644 index 0000000..5cadee9 --- /dev/null +++ b/src/packages/base-widgets/divider/index.tsx @@ -0,0 +1,40 @@ +import { Divider } from 'vant' +import { + createEditorColorProp, + createEditorSwitchProp, + createEditorInputProp, + createEditorSelectProp +} from '@/visual-editor/visual-editor.props' +import { VisualEditorComponent } from '@/visual-editor/visual-editor.utils' + +export default { + key: 'divider', + moduleName: 'baseWidgets', + label: '分割线', + preview: () => 文本, + render: ({ props }) => { + const style = `color:${props['text-color']};borderColor:${props['divider-color']}` + return props.text ? ( + + {props.text} + + ) : ( + + ) + }, + props: { + text: createEditorInputProp({ label: '展示文本', defaultValue: '文本' }), + 'content-position': createEditorSelectProp({ + label: '文本位置', + options: [ + { label: '左边', val: 'left' }, + { label: '中间', val: 'center' }, + { label: '右边', val: 'right' } + ], + defaultValue: 'center' + }), + dashed: createEditorSwitchProp({ label: '是否为虚线' }), + 'text-color': createEditorColorProp('文本颜色'), + 'divider-color': createEditorColorProp('分割线颜色') + } +} as VisualEditorComponent