Skip to content

Commit

Permalink
Merge branch 'develop'
Browse files Browse the repository at this point in the history
  • Loading branch information
felixpy committed Apr 24, 2019
2 parents e839ad7 + b8d144d commit a98c2da
Show file tree
Hide file tree
Showing 5 changed files with 20 additions and 16 deletions.
2 changes: 1 addition & 1 deletion README.zh-CN.md
Original file line number Diff line number Diff line change
Expand Up @@ -4,7 +4,7 @@
[![License](https://img.shields.io/npm/l/element-form-builder.svg)](https://www.npmjs.com/package/element-form-builder)
[![Dependencies](https://img.shields.io/david/codetrial/element-form-builder.svg)](https://www.npmjs.com/package/element-form-builder)

使用 JSON 配置构建 element-ui 动态表单.
使用 JSON 配置构建 element-ui 动态表单

:cn: 简体中文 | [:us: English](README.md)

Expand Down
14 changes: 7 additions & 7 deletions dist/index.js
Original file line number Diff line number Diff line change
@@ -1,5 +1,5 @@
/**
* Element form-builder v1.0.0
* element-form-builder v1.1.0
* (c) 2019 Felix Yang
*/
var _extends = Object.assign || function (target) {
Expand Down Expand Up @@ -182,17 +182,17 @@ var FormBuilder = {

children = [checkbox];
} else if (tag === 'el-radio') {
var radios = (detail.items || []).map(function (rc) {
var rcDetail = _extends({
var radios = (detail.items || []).map(function (option) {
option = _extends({
name: detail.name
}, rc);
}, option);
return h(tag, {
attrs: _extends({}, rcDetail),
attrs: _extends({}, option),
props: _extends({
value: value
}, rcDetail),
}, option),
on: _extends({}, modelEvents)
}, [rc.text]);
}, [option.text]);
});
children = [].concat(toConsumableArray(radios));
} else {
Expand Down
6 changes: 5 additions & 1 deletion package.json
Original file line number Diff line number Diff line change
@@ -1,8 +1,12 @@
{
"name": "element-form-builder",
"version": "1.0.0",
"version": "1.1.0",
"description": "Build element-ui forms with JSON schema.",
"main": "dist/index.js",
"files": [
"src",
"dist"
],
"scripts": {
"build": "node scripts/build.js",
"test": "yarn test"
Expand Down
2 changes: 1 addition & 1 deletion scripts/build.js
Original file line number Diff line number Diff line change
Expand Up @@ -2,7 +2,7 @@ const babel = require('rollup-plugin-babel')
const rollup = require('rollup')
const version = process.env.VERSION || require('../package.json').version
const year = new Date().getFullYear()
const banner = `/**\n * Element form-builder v${version}\n * (c) ${year} Felix Yang\n */`
const banner = `/**\n * element-form-builder v${version}\n * (c) ${year} Felix Yang\n */`

const inputOptions = {
input: 'src/index.js',
Expand Down
12 changes: 6 additions & 6 deletions src/formbuilder.js
Original file line number Diff line number Diff line change
Expand Up @@ -176,26 +176,26 @@ export default {

children = [checkbox]
} else if (tag === 'el-radio') {
const radios = (detail.items || []).map(rc => {
const rcDetail = {
const radios = (detail.items || []).map(option => {
option = {
name: detail.name,
...rc
...option
}
return h(
tag,
{
attrs: {
...rcDetail
...option
},
props: {
value,
...rcDetail
...option
},
on: {
...modelEvents
}
},
[rc.text]
[option.text]
)
})
children = [...radios]
Expand Down

0 comments on commit a98c2da

Please sign in to comment.