@zgeaw/form-design
v1.0.9
Published
好用的vue可视化表单设计器组件
Downloads
12
Readme
安装
npm install @zgeaw/form-design
NodeJs:
请自行导入ElementUI
并挂载
import FormCreate from "@form-create/element-ui";
import FormDesign from "@zgeaw/form-design";
Vue.use(FormCreate);
Vue.use(FormDesign);
使用
<FormDesign ref="designer" :optionConfig="optionConfig" /> optionConfig = {
token: '', uploadApi: '' }
组件props
- menu
MenuList
重新配置拖拽的组件 - height
int|string
设计器组件高度, 默认100%
组件方法
获取当前生成表单的生成规则
type getRule = () => Rule[];
示例:
this.$refs.designer.getRule()
获取当前表单的全局配置
type getOption = () => Object;
设置当前生成表单的规则
type setRule = (rules: Rule[]) => void;
设置当前表单的全局配置
type setOption = (option: Object) => void;
增加一组拖拽组件
type addMenu = (menu: Menu) => void;
删除一组拖拽组件
type removeMenu = (name: string) => void;
批量覆盖插入拖拽组件
type setMenuItem = (name: string, items: MenuItem[]) => void;
插入一个拖拽组件到分组
type appendMenuItem = (name: string, item: MenuItem) => void;
删除一个拖拽组件
type removeMenuItem = (item: string | MenuItem) => void;
新增一个拖拽组件的生成规则
type addComponent = (item: DragRule) => void;