@form-create/vant-designer
Version:
基于Vant的移动端低代码可视化表单设计器,可以通过拖拽的方式快速创建表单,提高开发者对表单的开发效率。
52 lines (49 loc) • 1.39 kB
JavaScript
import uniqueId from '@form-create/utils/lib/unique';
import {localeOptions, localeProps, makeOptionsRule, makeTreeOptions} from '../../utils/index';
const label = '单选框';
const name = 'radio';
export default {
menu: 'main',
icon: 'icon-radio',
label,
name,
input: true,
event: ['change'],
validate: ['string', 'number'],
rule({t}) {
return {
type: name,
field: uniqueId(),
title: t('com.radio.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: 'switch',
field: 'disabled',
},
{
type: 'ColorInput',
field: 'checkedColor',
},
{
type: 'select',
field: 'direction',
options: localeOptions(t, [
{label: 'horizontal', value: 'horizontal'},
{label: 'vertical', value: 'vertical'},
]),
},
]);
}
};