Skip to content

Commit cc169c9

Browse files
committed
修复 #47和验证字段问题
1 parent 1509c19 commit cc169c9

File tree

10 files changed

+81
-46
lines changed

10 files changed

+81
-46
lines changed

dist/FormMaking.common.js

Lines changed: 5 additions & 5 deletions
Some generated files are not rendered by default. Learn more about customizing how changed files appear on GitHub.

dist/FormMaking.umd.js

Lines changed: 5 additions & 5 deletions
Some generated files are not rendered by default. Learn more about customizing how changed files appear on GitHub.

dist/FormMaking.umd.min.js

Lines changed: 5 additions & 5 deletions
Some generated files are not rendered by default. Learn more about customizing how changed files appear on GitHub.

package-lock.json

Lines changed: 28 additions & 12 deletions
Some generated files are not rendered by default. Learn more about customizing how changed files appear on GitHub.

package.json

Lines changed: 2 additions & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -1,7 +1,7 @@
11
{
22
"name": "form-making",
33
"description": "基于Vue,ElementUI开发的一款表单设计器,提高表单开发效率的利器,让开发者从枯燥的表单代码编写中解放出来",
4-
"version": "1.1.18",
4+
"version": "1.1.19",
55
"author": "GavinZhulei",
66
"license": "MIT",
77
"keywords": [
@@ -53,6 +53,7 @@
5353
"rollup-plugin-uglify-es": "0.0.1",
5454
"rollup-plugin-vue": "^3.0.0",
5555
"sass-loader": "^7.0.1",
56+
"terser-webpack-plugin": "^1.2.4",
5657
"uglifyjs-webpack-plugin": "^2.0.1",
5758
"vue-template-compiler": "^2.6.5"
5859
},

src/App.vue

Lines changed: 1 addition & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -5,6 +5,7 @@
55
<div class="fm-title" @click="handleHome">表单设计器</div>
66

77
<div class="fm-link">
8+
<a target="_blank" href="https://www.yuque.com/zhulei-sbpfz/ua9nar">开始使用</a>
89
<a target="_blank" href="#/price">商业授权</a>
910
<a href="https://github.com/GavinZhuLei/vue-form-making">GitHub</a>
1011
<a href="https://gitee.com/gavinzhulei/vue-form-making">码云</a>

src/components/WidgetConfig.vue

Lines changed: 31 additions & 15 deletions
Original file line numberDiff line numberDiff line change
@@ -415,20 +415,9 @@ export default {
415415
}
416416
417417
}
418-
}
419-
},
420-
watch: {
421-
'data.options.isRange': function(val) {
422-
if (typeof val !== 'undefined') {
423-
if (val) {
424-
this.data.options.defaultValue = null
425-
} else {
426-
if (Object.keys(this.data.options).indexOf('defaultValue')>=0)
427-
this.data.options.defaultValue = ''
428-
}
429-
}
430418
},
431-
'data.options.required': function(val) {
419+
420+
validateRequired (val) {
432421
if (val) {
433422
this.validator.required = {required: true, message: `${this.data.name}必须填写`}
434423
} else {
@@ -439,7 +428,8 @@ export default {
439428
this.generateRule()
440429
})
441430
},
442-
'data.options.dataType': function (val) {
431+
432+
validateDataType (val) {
443433
if (!this.show) {
444434
return false
445435
}
@@ -452,7 +442,7 @@ export default {
452442
453443
this.generateRule()
454444
},
455-
'data.options.pattern': function (val) {
445+
valiatePattern (val) {
456446
if (!this.show) {
457447
return false
458448
}
@@ -465,6 +455,32 @@ export default {
465455
466456
this.generateRule()
467457
}
458+
},
459+
watch: {
460+
'data.options.isRange': function(val) {
461+
if (typeof val !== 'undefined') {
462+
if (val) {
463+
this.data.options.defaultValue = null
464+
} else {
465+
if (Object.keys(this.data.options).indexOf('defaultValue')>=0)
466+
this.data.options.defaultValue = ''
467+
}
468+
}
469+
},
470+
'data.options.required': function(val) {
471+
this.validateRequired(val)
472+
},
473+
'data.options.dataType': function (val) {
474+
this.validateDataType(val)
475+
},
476+
'data.options.pattern': function (val) {
477+
this.valiatePattern(val)
478+
},
479+
'data.name': function (val) {
480+
this.validateRequired(this.data.options.required)
481+
this.validateDataType(this.data.options.dataType)
482+
this.valiatePattern(this.data.options.pattern)
483+
}
468484
}
469485
}
470486
</script>

src/components/WidgetForm.vue

Lines changed: 1 addition & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -167,7 +167,7 @@ export default {
167167
rules: []
168168
})
169169
170-
if (row.columns[colIndex].list[newIndex].type === 'radio' || row.columns[colIndex].list[newIndex].type === 'checkbox' || this.data.list[newIndex].type === 'select') {
170+
if (row.columns[colIndex].list[newIndex].type === 'radio' || row.columns[colIndex].list[newIndex].type === 'checkbox' || row.columns[colIndex].list[newIndex].type === 'select') {
171171
this.$set(row.columns[colIndex].list, newIndex, {
172172
...row.columns[colIndex].list[newIndex],
173173
options: {

vue-form-making.zip

-23 MB
Binary file not shown.

vue.config.js

Lines changed: 3 additions & 2 deletions
Original file line numberDiff line numberDiff line change
@@ -1,12 +1,13 @@
11
const UglifyJsPlugin = require('uglifyjs-webpack-plugin')
2+
const TerserPlugin = require('terser-webpack-plugin')
23

34
module.exports = {
45
productionSourceMap: false,
56
publicPath: './',
67
configureWebpack: config => {
78
let plugins = [
8-
new UglifyJsPlugin({
9-
uglifyOptions: {
9+
new TerserPlugin({
10+
terserOptions: {
1011
compress: {
1112
warnings: false,
1213
drop_debugger: false,

0 commit comments

Comments
 (0)