diff --git a/app/main.js b/app/main.js
index 2552eda..d4ad056 100644
--- a/app/main.js
+++ b/app/main.js
@@ -14,7 +14,13 @@ import './theme/index.css'
import 'codemirror/theme/cobalt.css'
import 'codemirror/mode/javascript/javascript.js'
-import SchemaForm, { SchemaFormItem, SchemaFormJsoneditor, SchemaFormQuill, SchemaFormCodemirror } from '../src/index'
+import SchemaForm, {
+ SchemaFormItem,
+ SchemaFormJsoneditor,
+ SchemaFormQuill,
+ SchemaFormCodemirror
+} from '../src/index'
+// } from '../lib/element-schema-form.common'
Vue.use(ElementUI, {
size: 'small'
diff --git a/app/store/global-actions.js b/app/store/global-actions.js
index 8a77090..da57c02 100644
--- a/app/store/global-actions.js
+++ b/app/store/global-actions.js
@@ -2,6 +2,10 @@ import types from './mutation-types'
import Immutable from 'immutable'
import shortid from 'js-shortid'
+const makeAction = type => {
+ return ({ commit }, ...args) => commit(type, ...args)
+}
+
export default {
addRow ({ commit, state }, reload) {
let { layoutSections } = state
@@ -67,7 +71,7 @@ export default {
let _list = Immutable.fromJS(layoutSections)
commit(types.UPDATE_LAYOUT_SECTIONS, _list.set(activeSection, newVal).toJS())
},
- async delteColComp ({ commit, state, dispatch }, { colIndex, newVal, prop }) {
+ async deleteColComp ({ commit, state, dispatch }, { colIndex, newVal, prop }) {
let { layoutSections, activeSection } = state
let _list = Immutable.fromJS(layoutSections)
console.log(1)
@@ -123,5 +127,6 @@ export default {
] })
}
commit(types.UPDATE_ACTIVE_PROP, `default_${_propIdx}`)
- }
+ },
+ resetGlobalStore: makeAction('RESET_GLOBAL_STORE')
}
diff --git a/app/store/global-mutations.js b/app/store/global-mutations.js
index 9e1223e..4612f06 100644
--- a/app/store/global-mutations.js
+++ b/app/store/global-mutations.js
@@ -30,5 +30,29 @@ export default {
},
[types.UPDATE_FORM_CONTROL] (state, load) {
state.formControl = Object.assign(state.formControl, load)
+ },
+ [types.RESET_GLOBAL_STORE](state, load) {
+ const originState = {
+ iterationIdx: 0, // 迭代指针
+ layoutSections: [], // schema 信息
+ formModel: {},
+ formOptions: {},
+ formLayout: { // 表单布局
+ gutter: 16,
+ justify: 'start'
+ },
+ formSettings: { // 表单属性
+ labelPosition: 'left',
+ size: 'small',
+ labelWidth: '80px'
+ },
+ formControl: { // 布局控制
+ showGrid: false,
+ showLayout: false
+ },
+ activeSection: 0, // 激活的行数
+ activeProp: '' // 激活的组件prop
+ }
+ state = Object.assign(state, originState)
}
}
diff --git a/app/store/mutation-types.js b/app/store/mutation-types.js
index 26a1a2c..5eb4826 100644
--- a/app/store/mutation-types.js
+++ b/app/store/mutation-types.js
@@ -7,5 +7,6 @@ export default {
UPDATE_ITERATION_IDX: 'UPDATE_ITERATION_IDX',
UPDATE_FORM_SETTING: 'UPDATE_FORM_SETTING',
UPDATE_FORM_LAYOUT: 'UPDATE_FORM_LAYOUT',
- UPDATE_FORM_CONTROL: 'UPDATE_FORM_CONTROL'
+ UPDATE_FORM_CONTROL: 'UPDATE_FORM_CONTROL',
+ RESET_GLOBAL_STORE: 'RESET_GLOBAL_STORE'
}
diff --git a/app/views/form-generator/aside-panel/index.vue b/app/views/form-generator/aside-panel/index.vue
index 6288a2a..6254923 100644
--- a/app/views/form-generator/aside-panel/index.vue
+++ b/app/views/form-generator/aside-panel/index.vue
@@ -99,7 +99,7 @@ export default {
'editRow',
'deleteRow',
'changeRow',
- 'delteColComp'
+ 'deleteColComp'
]),
checkMove (e) {
console.log('Future index: ' + e.draggedContext.futureIndex)
@@ -109,7 +109,7 @@ export default {
isCustom: 'btn-addCol',
colGrid: element.colGrid
}
- this.delteColComp({ colIndex, newVal: oldSection, prop: element.prop })
+ this.deleteColComp({ colIndex, newVal: oldSection, prop: element.prop })
},
onAddRow (data) {
const initVal = data.map((val, idx) => {
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 7dcf445..0461c5a 100644
--- a/app/views/form-generator/config-panel/module/component-panel.vue
+++ b/app/views/form-generator/config-panel/module/component-panel.vue
@@ -5,15 +5,15 @@
通用属性
-
-
-
-
-
-
-
-
-
+
+
+
+
+
+
+
+
+