@form-create/vant-designer
Version:
基于Vant的移动端低代码可视化表单设计器,可以通过拖拽的方式快速创建表单,提高开发者对表单的开发效率。
53 lines (50 loc) • 1.36 kB
JavaScript
import uniqueId from '@form-create/utils/lib/unique';
import {localeProps, makeOptionsRule, makeTreeOptions} from '../../utils/index';
const label = '选择器';
const name = 'select';
export default {
menu: 'main',
icon: 'icon-select',
label,
name,
input: true,
event: ['confirm', 'cancel', 'change', 'clickOption', 'scrollInto'],
validate: ['string', 'number'],
rule({t}) {
return {
type: name,
field: uniqueId(),
title: t('com.select.name'),
info: '',
effect: {
fetch: ''
},
$required: false,
props: {},
optionsTo: 'props.options',
options: makeTreeOptions(t('props.option'), {label: 'text', value: 'value'}, 1)
};
},
props(_, {t}) {
return localeProps(t, name + '.props', [
makeOptionsRule(t, 'options'),
{
type: 'input',
field: 'title',
},
{
type: 'switch',
field: 'disabled',
},
{
type: 'switch',
field: 'readonly',
},
{
type: 'inputNumber',
field: 'visibleOptionNum',
value: 6,
},
])
}
};