0.0.5 • Published 3 years ago

yyhht-form-design v0.0.5

Weekly downloads
-
License
MIT
Repository
-
Last release
3 years ago

简介

本项目是一款基于 Avue 的单据表单设计器,拖拽式操作让你快速构建一个表单。

更新日志

文档及demo项目

依赖

element-ui 2.13.2+

$ npm i element-ui

@smallwei/avue 2.6.16+

$ npm i @smallwei/avue

或自行引入cdn

安装

组件

$ npm i yyhht-form-design
或
$ yarn add yyhht-form-design
$ yarn
$ yarn serve

html

详见examples

使用

import HhtFormDesign from 'yyhht-form-design'

Vue.use(HhtFormDesign)
<hht-form-design style="height: 86vh;"
                  :options="options"
                  storage
                  @submit="handleSubmit"></hht-form-design>

属性

参数说明类型默认值
options字段配置Object/String{ column: [] }
storage开启本地存储功能,防止浏览器刷新丢失jsonBooleanfalse
asideLeftWidth左工具栏宽度String/Number'270px'
asideRightWidth右工具栏宽度String/Number'380px'
showAvueDoc(已废弃,请使用toolbar)是否显示Avue文档Booleanfalse
showGithubStar是否显示GitHub StarBooleantrue
toolbar顶部工具栏Array'avue-doc', 'import', 'generate', 'preview', 'clear'
undoRedo是否开启撤销重做功能Booleantrue
includeFields左侧展示字段ArrayfieldsConfig.js中配置的字段
customFields自定义组件Array使用方法

options字段配置

Avue文档

属性说明类型可选值默认值
columnAvue字段Array-[]
labelPosition字段位置String'left'/'center'/'right'-
labelWidth字段宽度Number--
gutter字段间隔Number-0
menuBtn表单按钮Booleantrue/falsetrue
submitBtn显示提交按钮Booleantrue/falsetrue
submitText提交按钮文本String-'提交'
emptyBtn显示清空按钮Booleantrue/falsetrue
emptyText清空按钮文本String-'清空'
tabs多分组转标签Booleantrue/falsefalse
detail详情模式Booleantrue/falsefalse
readonly全局只读Booleantrue/falsefalse
disabled全局禁用Booleantrue/falsefalse
hide是否隐藏列Booleantrue/falsefalse
showColumn是否加入动态现隐列Booleantrue/falsetrue
overHidden是否文字超出隐藏Booleantrue/falsetrue
search是否支持搜索Booleantrue/falsefalse
searchSpan搜索框栅列Number-8
addBtn显示新增按钮Booleantrue/falsetrue
addBtnText新增按钮文字String-'新增'
menu显示操作菜单栏Booleantrue/falsetrue
viewBtn显示查看按钮Booleantrue/falsetrue
viewBtnText查看按钮文字String-'查看'
editBtn显示编辑按钮Booleantrue/falsetrue
editBtnText编辑按钮文字String-'编辑'
delBtn显示删除按钮Booleantrue/falsetrue
delBtnText删除按钮文字String-'删除'

事件

名称说明回调参数
submit生成json回调当前配置的json

方法

名称说明参数返回
getData获取当前编辑器的JSONtype: 'string'/'json'Promise

插槽

名称说明
toolbar顶部工具栏右侧插槽
toolbar-left顶部工具栏左侧插槽

Avue插件

富文本

import AvueUeditor from 'avue-plugin-ueditor'

Vue.use(AvueUeditor)

打包

组件

$ yarn lib

源码

$ yarn build