0.0.2 • Published 5 years ago

w-json-form v0.0.2

Weekly downloads
2
License
MIT
Repository
github
Last release
5 years ago

my-form

ui component for vue base on element-ui, json 2 form

Preview

# clone
git clone git@github.com:stack-wuh/my-form.git

cd example

npm install 

npm run dev

Build Setup

# install dependencies
npm install

# serve with hot reload at localhost:8080
npm run dev

# build for production with minification
npm run build

For detailed explanation on how things work, consult the docs for vue-loader.

使用

WForm

Props

参数说明类型默认值
fieldListform表单的JSON配置列表Arraynone
model双向绑定对象Objectnone

FieldList 配置

二维数组, 小数组代表行, 小数组内的对象代表列
满足了单行多列的需求

[
  [
    {
      label: 'first name', // -- 表单项目的Label
      field: 'firstName', // -- 表单项目绑定的key
      props: {}, // 深度配置对象, 同element配置
    },
    {
      label: 'last name',
      field: 'lastName'
    }
  ],
  [
    {
      label: 'sex',
      field: 'sex',
      type: 'select',
      list: [
        {
          label: '男',
          value: 1
        }
      ]
    },
    {
      label: 'birth',
      field: 'birth',
      type: 'date',
      props: {
        type: 'date',
        placeholder: '出生日期'
      }
    }
  ],
  [
    {
      label: 'smart',
      field: 'smart',
      type: 'switch'
    }
  ],
  [
    {
      label: 'avatar',
      field: 'avatar',
      type: 'upload',
      props: {
        type: 'image', // image: 单张图片, images: 多张图片, file: 上传文件
        action: 'https://www.baidu.com'
      }
    }
  ]
]

type List

name说明默认值
default, normal, undefined, null全部默认为Input输入框input
selectel-select, 下拉框--
date, daterange日期, 日期区间date
switchswitch组件--
upload文件上传组件file, 文件类型的上传
custom自定义区域component

Feature custom

功能性属性配置, 用于FieldList中需要多级联动的处理

name说明类型
handle处理表单项目中, disbaled属性的设置Function, Boolean
ifRender处理表单项目中, 选择了A才能出现B或者是选择B的情况Function, Boolean
validator表单项目Rules的配置项Function, Array

ImageGroup 图片展示

Props

参数说明类型默认值
list所有图片的数组Arraynone
show-close是否展示右上角Close图标true

image list option

图片的进出场动画要求_id值唯一

{
  _id: String, Number, // 值唯一
  mini: src, // 缩略图
  default: src // 原图
}

ImageItem

Props

参数说明类型默认值
width图片宽度String220px
height图片高度String220px
show-close是否展示右上角Close图标Booleantrue
url每一张Image的地址对象Objectnone
0.0.2

5 years ago

0.0.1-e

5 years ago

0.0.1-d

5 years ago

0.0.1-c

5 years ago

0.0.1-a

5 years ago

0.0.1

5 years ago