typescriptvuenocodevue3drag-and-dropvitelowcodetsxlow-codevuex4vue-router4designdraggableelement-pluselement-uimonaco-editortsvant-uidemo
You can not select more than 25 topics
Topics must start with a letter or number, can include dashes ('-') and can be up to 35 characters long.
37 lines
1.1 KiB
37 lines
1.1 KiB
import { ElOption, ElSelect } from 'element-plus'
|
|
import { createEditorTableProp } from '@/visual-editor/visual-editor.props'
|
|
import { VisualEditorComponent } from '@/visual-editor/visual-editor.utils'
|
|
|
|
export default {
|
|
key: 'select',
|
|
moduleName: 'baseWidgets',
|
|
label: '下拉框',
|
|
preview: () => <ElSelect />,
|
|
render: ({ props, model, custom }) => (
|
|
<ElSelect
|
|
{...custom}
|
|
key={(props.options || []).map((opt: any) => opt.value).join(',')}
|
|
{...model.default}
|
|
>
|
|
{(props.options || []).map((opt: { label: string; value: string }, index: number) => (
|
|
<ElOption label={opt.label} value={opt.value} key={index} />
|
|
))}
|
|
</ElSelect>
|
|
),
|
|
props: {
|
|
options: createEditorTableProp({
|
|
label: '下拉选项',
|
|
option: {
|
|
options: [
|
|
{ label: '显示值', field: 'label' },
|
|
{ label: '绑定值', field: 'value' },
|
|
{ label: '备注', field: 'comments' }
|
|
],
|
|
showKey: 'label'
|
|
}
|
|
})
|
|
},
|
|
model: {
|
|
default: '绑定字段'
|
|
}
|
|
} as VisualEditorComponent
|
|
|