form-tdesigner
Version:
好用的Vue低代码可视化表单设计器,可以通过拖拽的方式快速创建表单,提高开发者对表单的开发效率。
77 lines (72 loc) • 1.75 kB
JavaScript
import uniqueId from '@form-create/utils/lib/unique';
import {
getInjectArg,
localeProps,
makeOptionsRule,
makeTreeOptions,
} from '../../utils/index';
import { localeOptions } from "../../utils";
const label = '选择器';
const name = 'select';
export default {
menu: 'main',
icon: 'icon-select',
label,
name,
event: ['change', 'visibleChange', 'removeTag', 'clear', 'blur', 'focus'],
validate: ['string', 'number', 'array'],
rule({ t }) {
return {
type: name,
field: uniqueId(),
title: t('com.select.name'),
info: '',
effect: {
fetch: '',
},
$required: false,
props: {},
options: makeTreeOptions(
t('props.option'),
{ label: 'label', value: 'value' },
1,
),
};
},
watch: {
multiple({ rule }) {
rule.key = uniqueId();
},
},
props(_, { t }) {
return localeProps(t, name + '.props', [
makeOptionsRule(t, 'options'),
{ type: 'switch', field: 'multiple' },
{
type: 'switch',
field: 'disabled',
},
{
type: "select",
field: "size",
options: localeOptions(t, [
{ label: "small", value: "small" },
{ label: "medium", value: "medium" },
{ label: "large", value: "large" },
]),
},
{ type: 'switch', field: 'clearable' },
{ type: 'input', field: 'placeholder' },
{
type: 'switch',
field: 'filterable',
},
{ type: 'switch', field: 'creatable' },
{ type: 'input', field: 'empty' },
{
type: 'switch',
field: 'reserveKeyword',
},
]);
},
};