From 3ad47566a451f3a4231eeac9752edcd24c38d1e3 Mon Sep 17 00:00:00 2001 From: 梁灏 Date: Wed, 4 Jan 2017 11:25:59 +0800 Subject: [PATCH] update Select --- src/components/select/select.vue | 7 +++++++ src/styles/components/form.less | 2 +- test/routers/form.vue | 53 ++++++++++++++++++++++++++++++++++++++++++++++++++++- 3 files changed, 60 insertions(+), 2 deletions(-) diff --git a/src/components/select/select.vue b/src/components/select/select.vue index 035eb13..ca9b436 100644 --- a/src/components/select/select.vue +++ b/src/components/select/select.vue @@ -310,8 +310,13 @@ value: value, label: label }); + this.$dispatch('on-form-change', { + value: value, + label: label + }); } else { this.$emit('on-change', value); + this.$dispatch('on-form-change', value); } } } @@ -340,8 +345,10 @@ if (!init) { if (this.labelInValue) { this.$emit('on-change', hybridValue); + this.$dispatch('on-form-change', hybridValue); } else { this.$emit('on-change', value); + this.$dispatch('on-form-change', value); } } } diff --git a/src/styles/components/form.less b/src/styles/components/form.less index f4bb9d7..f32095b 100644 --- a/src/styles/components/form.less +++ b/src/styles/components/form.less @@ -35,7 +35,7 @@ .clearfix(); &-content { position: relative; - line-height: 32px; + //line-height: 32px; font-size: @font-size-small; } diff --git a/test/routers/form.vue b/test/routers/form.vue index 6d322fd..5a97a12 100644 --- a/test/routers/form.vue +++ b/test/routers/form.vue @@ -50,6 +50,16 @@ + + + {{ item.label }} + + + + + {{ item.label }} + + 提交 @@ -61,12 +71,40 @@ props: {}, data () { return { + cityList: [ + { + value: 'beijing', + label: '北京市' + }, + { + value: 'shanghai', + label: '上海市' + }, + { + value: 'shenzhen', + label: '深圳市' + }, + { + value: 'hangzhou', + label: '杭州市' + }, + { + value: 'nanjing', + label: '南京市' + }, + { + value: 'chongqing', + label: '重庆市' + } + ], form: { mail: '', passwd: '', single: false, group: '', - checkboxgroup: [] + checkboxgroup: [], + select: '', + selectm: [] }, rules: { mail: [ @@ -97,6 +135,19 @@ { required: true, message: '至多选择3个', max: 3, type: 'array' } + ], + select: [ + { + required: true + } + ], + selectm: [ + { + required: true, type: 'array' + }, + { + min: 2, type: 'array' + } ] } } -- libgit2 0.21.4