feat(components): 新增进度条组件

This commit is contained in:
UxieVerity 2021-06-11 17:01:43 +08:00
parent 2077481d89
commit 98eddebf30
1 changed files with 29 additions and 0 deletions

View File

@ -0,0 +1,29 @@
import { Progress } from 'vant'
import {
createEditorColorProp,
createEditorSwitchProp,
createEditorInputProp,
createEditorInputNumberProp
} from '@/visual-editor/visual-editor.props'
import { VisualEditorComponent } from '@/visual-editor/visual-editor.utils'
export default {
key: 'divider',
moduleName: 'baseWidgets',
label: '进度条',
preview: () => <Progress style="width:190px" percentage={0} />,
render: ({ props }) => {
return <Progress {...props} pivotText={props.pivotText || undefined} />
},
props: {
percentage: createEditorInputNumberProp({ label: '进度百分比', defaultValue: 50 }),
strokeWidth: createEditorInputNumberProp({ label: '线条粗细', defaultValue: 5 }),
inactive: createEditorSwitchProp({ label: '是否置灰', defaultValue: false }),
color: createEditorColorProp('进度条颜色', '#1989fa'),
trackColor: createEditorColorProp('轨道颜色', '#e5e5e5'),
pivotText: createEditorInputProp({ label: '进度文字内容' }),
pivotColor: createEditorColorProp('进度文字背景色', '#1989fa'),
textColor: createEditorColorProp('进度文字颜色', '#ffffff'),
showPivot: createEditorSwitchProp({ label: '是否显示进度文字', defaultValue: true })
}
} as VisualEditorComponent