diff --git a/src/components/cascader/cascader.vue b/src/components/cascader/cascader.vue index ed94961..a27017c 100644 --- a/src/components/cascader/cascader.vue +++ b/src/components/cascader/cascader.vue @@ -141,6 +141,7 @@ emitValue (val, oldVal) { if (JSON.stringify(val) !== oldVal) { this.$emit('on-change', this.value, JSON.parse(JSON.stringify(this.selected))); + this.$dispatch('on-form-change', this.value, JSON.parse(JSON.stringify(this.selected))); } } }, @@ -168,6 +169,12 @@ if (lastValue && !fromInit) { this.handleClose(); } + }, + 'on-form-blur' () { + return false; + }, + 'on-form-change' () { + return false; } }, watch: { diff --git a/src/styles/components/cascader.less b/src/styles/components/cascader.less index 7616235..91e8076 100644 --- a/src/styles/components/cascader.less +++ b/src/styles/components/cascader.less @@ -3,6 +3,7 @@ .@{cascader-prefix-cls} { position: relative; + line-height: normal; .@{css-prefix}input{ display: block; diff --git a/test/routers/form.vue b/test/routers/form.vue index 78d2fb2..8af2291 100644 --- a/test/routers/form.vue +++ b/test/routers/form.vue @@ -155,6 +155,9 @@ + + + 提交 @@ -166,6 +169,53 @@ props: {}, data () { return { + data: [{ + value: 'beijing', + label: '北京', + children: [ + { + value: 'gugong', + label: '故宫' + }, + { + value: 'tiantan', + label: '天坛' + }, + { + value: 'wangfujing', + label: '王府井' + } + ] + }, { + value: 'jiangsu', + label: '江苏', + children: [ + { + value: 'nanjing', + label: '南京', + children: [ + { + value: 'fuzimiao', + label: '夫子庙', + } + ] + }, + { + value: 'suzhou', + label: '苏州', + children: [ + { + value: 'zhuozhengyuan', + label: '拙政园', + }, + { + value: 'shizilin', + label: '狮子林', + } + ] + } + ], + }], cityList: [ { value: 'beijing', @@ -202,7 +252,8 @@ selectm: [], slider: [40, 50], date: '', - date2: '' + date2: '', + cascader: [] }, rules: { mail: [ @@ -272,6 +323,11 @@ } } } + ], + cascader: [ + { + type: 'array', required: true + } ] } } -- libgit2 0.21.4