diff --git a/app/main.js b/app/main.js
index 7084d62..886f695 100644
--- a/app/main.js
+++ b/app/main.js
@@ -12,7 +12,7 @@ import 'element-ui/lib/theme-chalk/index.css'
import 'codemirror/theme/cobalt.css'
import 'codemirror/mode/javascript/javascript.js'
-import SchemaForm, { SchemaFormJsoneditor, SchemaFormQuill, SchemaFormCodemirror } from '../src/index'
+import SchemaForm, { SchemaFormItem, SchemaFormJsoneditor, SchemaFormQuill, SchemaFormCodemirror } from '../src/index'
Vue.use(ElementUI, {
size: 'small'
@@ -21,6 +21,8 @@ Vue.component('SchemaFormJsoneditor', SchemaFormJsoneditor)
Vue.component('SchemaFormQuill', SchemaFormQuill)
Vue.component('SchemaFormCodemirror', SchemaFormCodemirror)
+Vue.component('SchemaFormItem', SchemaFormItem)
+
Vue.use(SchemaForm, {
'codemirror': {
cmOptions: {
diff --git a/app/views/form-generator/aside-panel/index.vue b/app/views/form-generator/aside-panel/index.vue
index 3e4b80a..ad76a98 100644
--- a/app/views/form-generator/aside-panel/index.vue
+++ b/app/views/form-generator/aside-panel/index.vue
@@ -1,27 +1,11 @@
-
-
-
-
-
-
+
+
{{ element.prop }}
@@ -48,68 +33,31 @@
-
diff --git a/app/views/form-generator/config-panel/index.vue b/app/views/form-generator/config-panel/index.vue
index cf64b87..c692d51 100644
--- a/app/views/form-generator/config-panel/index.vue
+++ b/app/views/form-generator/config-panel/index.vue
@@ -59,7 +59,7 @@
-
+
@@ -83,6 +83,9 @@ export default {
editCompAttr (prop) {
this.editProp = prop || ''
this.activeTab = 'componentSetting'
+ },
+ onClearProp () {
+ this.$emit('clearProp')
}
}
}
diff --git a/app/views/form-generator/config-panel/module/component-panel.vue b/app/views/form-generator/config-panel/module/component-panel.vue
index fc3c1e4..f671126 100644
--- a/app/views/form-generator/config-panel/module/component-panel.vue
+++ b/app/views/form-generator/config-panel/module/component-panel.vue
@@ -89,7 +89,7 @@ export default {
return true
},
reset () {
- this.$emit('update:editProp', '')
+ this.$emit('success')
this.lastProp = ''
this.editInfo = {
formItem: {}
diff --git a/app/views/form-generator/index.vue b/app/views/form-generator/index.vue
index ba55dd6..8232e1c 100644
--- a/app/views/form-generator/index.vue
+++ b/app/views/form-generator/index.vue
@@ -1,7 +1,11 @@
@@ -69,13 +70,15 @@
diff --git a/package-lock.json b/package-lock.json
index f89d6e8..6124b9c 100644
--- a/package-lock.json
+++ b/package-lock.json
@@ -7343,6 +7343,11 @@
"integrity": "sha512-3j8wdDzYuWO3lM3Reg03MuQR957t287Rpcxp1njpEa8oDrikb+FwGdW3n+FELh/A6qib6yPit0j/pv9G/yeAqA==",
"dev": true
},
+ "lodash.isequal": {
+ "version": "4.5.0",
+ "resolved": "https://registry.npmjs.org/lodash.isequal/-/lodash.isequal-4.5.0.tgz",
+ "integrity": "sha1-QVxEePK8wwEgwizhDtMib30+GOA="
+ },
"lodash.kebabcase": {
"version": "4.1.1",
"resolved": "https://registry.npmjs.org/lodash.kebabcase/-/lodash.kebabcase-4.1.1.tgz",
diff --git a/package.json b/package.json
index bc91bd2..3c5c801 100644
--- a/package.json
+++ b/package.json
@@ -18,6 +18,7 @@
"element-ui": "^2.11.1",
"jsoneditor": "^7.0.1",
"lodash.clonedeep": "^4.5.0",
+ "lodash.isequal": "^4.5.0",
"normalize.css": "^8.0.1",
"vue": "^2.6.10",
"vue-codemirror": "^4.0.6",
diff --git a/src/index.js b/src/index.js
index 1866cc9..17fab2c 100644
--- a/src/index.js
+++ b/src/index.js
@@ -17,8 +17,10 @@ import SchemaFormProgress from './packages/components/SchemaFormProgress.vue'
import SchemaFormJsoneditor from './packages/components/SchemaFormJsoneditor.vue'
import SchemaFormQuill from './packages/components/SchemaFormQuill.vue'
import SchemaFormCodemirror from './packages/components/SchemaFormCodemirror.vue'
+import SchemaFormItem from './packages/SchemaFormItem'
import FormMixin from './packages/mixins/form-mixin'
+import LayoutMixin from './packages/mixins/layout-mixin'
const components = [
SchemaForm,
@@ -52,7 +54,9 @@ export {
FormMixin,
SchemaFormJsoneditor,
SchemaFormQuill,
- SchemaFormCodemirror
+ SchemaFormCodemirror,
+ SchemaFormItem,
+ LayoutMixin
}
if (typeof window !== 'undefined' && window.Vue) {
diff --git a/src/packages/SchemaForm.vue b/src/packages/SchemaForm.vue
index 8429625..cb0ea28 100644
--- a/src/packages/SchemaForm.vue
+++ b/src/packages/SchemaForm.vue
@@ -8,24 +8,17 @@
>
-
-
-
-
-
-
+
+
@@ -35,53 +28,16 @@
@@ -97,5 +53,8 @@ export default {
.el-cascader{
width: 100%;
}
+ .el-date-editor.el-input{
+ width:100%;
+ }
}
diff --git a/src/packages/SchemaFormItem.vue b/src/packages/SchemaFormItem.vue
new file mode 100644
index 0000000..87420ca
--- /dev/null
+++ b/src/packages/SchemaFormItem.vue
@@ -0,0 +1,56 @@
+
+
+
+
+
+
+
+
+
+
+
diff --git a/src/packages/mixins/layout-mixin.js b/src/packages/mixins/layout-mixin.js
index 4519b10..4da9cc3 100644
--- a/src/packages/mixins/layout-mixin.js
+++ b/src/packages/mixins/layout-mixin.js
@@ -1,5 +1,27 @@
import cloneDeep from 'lodash.clonedeep'
export default {
+ props: {
+ layout: { // 关于el-row 的拓展
+ type: Object,
+ default () { return {} }
+ },
+ schema: { // 表单的格局
+ type: Array,
+ required: true,
+ validator (val) {
+ return val.every(arr => Array.isArray(arr) && arr.length > 0)
+ }
+ },
+ module: { // 绑定的value值
+ type: Object,
+ required: true,
+ default () { return {} }
+ },
+ options: { // 多选值绑定的陪选项目
+ type: Object,
+ default () { return {} }
+ }
+ },
computed: {
formatedSchema () {
let _schema = cloneDeep(this.schema)
diff --git a/vue.config.js b/vue.config.js
index 32d6772..791f939 100644
--- a/vue.config.js
+++ b/vue.config.js
@@ -8,6 +8,7 @@ const setChainWebpack = config => {
// 修改默认目录简写
config.resolve.alias
.set('@', path.resolve('app'))
+ .set('@lib', resolve('src'))
// 添加对 app 目录的支持
config.module
.rule('js')