form-tdesigner
Version:
好用的Vue低代码可视化表单设计器,可以通过拖拽的方式快速创建表单,提高开发者对表单的开发效率。
61 lines (58 loc) • 1.4 kB
JavaScript
import uniqueId from '@form-create/utils/lib/unique';
import {
localeProps,
makeOptionsRule,
makeTreeOptions,
localeOptions,
} from '../../utils/index';
const label = '单选框';
const name = 'radio';
export default {
menu: 'main',
icon: 'icon-radio',
label,
name,
event: ['change'],
validate: ['string', 'number'],
rule({ t }) {
return {
type: name,
field: uniqueId(),
title: t('com.radio.name'),
info: '',
effect: {
fetch: '',
},
$required: false,
props: {},
options: makeTreeOptions(
t('props.option'),
{ label: 'label', value: 'value' },
1,
),
};
},
props(_, { t }) {
return localeProps(t, name + '.props', [
makeOptionsRule(t, 'options'),
{ type: 'switch', field: 'disabled' },
{
type: 'select',
field: 'theme',
options: localeOptions(t, [
{ label: 'radio', value: 'radio' },
{ label: 'button', value: 'button' },
]),
},
{
type: 'select',
field: 'variant',
options: localeOptions(t, [
{ label: 'outline', value: 'outline' },
{ label: 'primary-filled', value: 'primary-filled' },
{ label: 'default-filled', value: 'default-filled' },
]),
},
]);
},
};