# w-json-form

> ui component for Vue base on element-ui, json options to form

Latest version **0.0.2** (published 2019-11-02) · MIT license · 0 weekly downloads

## Install

```sh
npm install w-json-form
pnpm add w-json-form
yarn add w-json-form
bun add w-json-form
```

## Health

**Score 30/100 (F)** — status: abandoned.

Positive: no vulnerabilities; high maintenance score.

Warnings: low downloads; no types; no esm support; pre 1.0.

Negative: abandoned.

## Facts

| | |
|---|---|
| Version | 0.0.2 |
| Published | 2019-11-02 |
| First published | 2019-09-25 |
| Weekly downloads | 0 |
| License | MIT |
| TypeScript types | none |
| Module format | CommonJS |
| Dependencies | 2 |
| Unpacked size | 823.4 KB |
| Known vulnerabilities | 0 (+1 in 1 direct dependencies) |
| Install scripts | no |
| GitHub stars | 0 |
| Author | shadow |
| Maintainers | wuhong |
| Keywords | vue, elementui, form, json |

## Links

- npm: https://www.npmjs.com/package/w-json-form
- Repository: https://github.com/stack-wuh/my-form
- Homepage: https://github.com/stack-wuh/my-form#readme
- Issues: https://github.com/stack-wuh/my-form/issues
- npm.io page: https://npm.io/package/w-json-form

## Dependencies (2)

- [vue](https://npm.io/package/vue.md) ^2.5.11
- [element-ui](https://npm.io/package/element-ui.md) ^2.12.0

## Alternatives

- [@mapbox/jsonlint-lines-primitives](https://npm.io/package/@mapbox/jsonlint-lines-primitives.md) — 5.3M weekly downloads
- [reftools](https://npm.io/package/reftools.md) — 3.5M weekly downloads
- [@hey-api/openapi-ts](https://npm.io/package/@hey-api/openapi-ts.md) — 3.5M weekly downloads
- [@mapbox/geojson-rewind](https://npm.io/package/@mapbox/geojson-rewind.md) — 2.4M weekly downloads
- [turbo-stream](https://npm.io/package/turbo-stream.md) — 1.7M weekly downloads

## Recent versions

- 0.0.2 (latest) — 2019-11-02
- 0.0.1-e — 2019-10-07
- 0.0.1-d — 2019-09-25
- 0.0.1-c — 2019-09-25
- 0.0.1-a — 2019-09-25
- 0.0.1 — 2019-09-25

## README

# my-form

> ui component for vue base on element-ui, json 2 form

## Preview
```bash 
# clone
git clone git@github.com:stack-wuh/my-form.git

cd example

npm install 

npm run dev
```

## Build Setup

``` bash
# 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](http://vuejs.github.io/vue-loader).

## 使用
### WForm
#### Props
| 参数 | 说明 | 类型 | 默认值 |
| :-- | :-- | :-- | :-- |
| fieldList | form表单的JSON配置列表 | Array | none |
| model | 双向绑定对象 | Object | none |

### FieldList 配置
> 二维数组, 小数组代表行, 小数组内的对象代表列        
> 满足了单行多列的需求
```javascript
[
  [
    {
      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 |
| select | el-select, 下拉框 | -- |
| date, daterange | 日期, 日期区间 | date |
| switch | switch组件 | -- |
| 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 | 所有图片的数组 | Array | none |
| show-close | 是否展示右上角Close图标 | true |

#### image list option
> 图片的进出场动画要求_id值唯一
```javascript
{
  _id: String, Number, // 值唯一
  mini: src, // 缩略图
  default: src // 原图
}
```

### ImageItem 
#### Props
| 参数 | 说明 | 类型 | 默认值 |
| :-- | :-- | :-- | :-- |
| width | 图片宽度 | String | 220px |
| height | 图片高度 | String | 220px |
| show-close | 是否展示右上角Close图标 | Boolean | true |
| url | 每一张Image的地址对象 | Object | none |

---
_Source: https://npm.io/package/w-json-form · Machine-readable twin of the npm.io package page. Health data is recomputed on every publish._
