diff --git a/package.json b/package.json index 2723c6a4..978c2dcc 100644 --- a/package.json +++ b/package.json @@ -20,8 +20,10 @@ "echarts": "3.8.2", "element-ui": "1.4.2", "file-saver": "1.3.3", + "hakim": "^0.2.5", "js-cookie": "2.1.4", "jsonlint": "1.6.2", + "jszip": "^3.1.4", "mockjs": "1.0.1-beta3", "normalize.css": "7.0.0", "nprogress": "0.2.0", @@ -36,8 +38,7 @@ "vue-splitpane": "^1.0.0", "vuedraggable": "2.14.1", "vuex": "2.3.1", - "xlsx": "^0.10.8", - "jszip": "^3.1.4" + "xlsx": "^0.10.8" }, "devDependencies": { "autoprefixer": "7.1.1", diff --git a/src/router/index.js b/src/router/index.js index a4cc7b9b..1c16ed16 100644 --- a/src/router/index.js +++ b/src/router/index.js @@ -119,6 +119,7 @@ export const asyncRouterMap = [ }, { path: 'form/edit', icon: 'form', component: _import('example/form'), name: '编辑Form', meta: { isEdit: true }}, { path: 'form/create', icon: 'form', component: _import('example/form'), name: '创建Form' }, + { path: 'form/validate', icon: 'form', component: _import('example/validation'), name: '验证Form' }, { path: 'tab/index', icon: 'tab', component: _import('example/tab/index'), name: 'Tab' } ] }, diff --git a/src/views/example/validation.vue b/src/views/example/validation.vue new file mode 100644 index 00000000..029e9c27 --- /dev/null +++ b/src/views/example/validation.vue @@ -0,0 +1,110 @@ + + + + element-ui自带的表单验证,有诸多不足。比如:一个表单项,要么为空,要么为整数,如何写?为了解决这个问题,引入hakim这个小工具, + 可以用与与或的方式来组合多条规则,灵活方便 + https://github.com/zzzgit/hakim + + + + + + + + + + + + + + 校验 + 重置 + + + + + + + + + +