@form-create/vant-designer
Version:
基于Vant的移动端低代码可视化表单设计器,可以通过拖拽的方式快速创建表单,提高开发者对表单的开发效率。
52 lines (49 loc) • 1.18 kB
JavaScript
import uniqueId from '@form-create/utils/lib/unique';
import {localeProps} from '../../utils';
const label = '开关';
const name = 'switch';
export default {
menu: 'main',
icon: 'icon-switch',
label,
name,
input: true,
event: ['change', 'click'],
rule({t}) {
return {
type: name,
field: uniqueId(),
title: t('com.switch.name'),
info: '',
$required: false,
props: {
activeValue: true,
inactiveValue: false,
},
};
},
props(_, {t}) {
return localeProps(t, name + '.props', [
{
type: 'switch',
field: 'disabled',
},
{
type: 'ColorInput',
field: 'activeColor',
},
{
type: 'ColorInput',
field: 'inactiveColor',
},
{
type: 'ValueInput',
field: 'activeValue',
},
{
type: 'ValueInput',
field: 'inactiveValue',
}
]);
}
};