From 5722a6fb91700a246221fdb6a331416fc3022f80 Mon Sep 17 00:00:00 2001 From: 梁灏 <admin@aresn.com> Date: Thu, 5 Jan 2017 14:37:24 +0800 Subject: [PATCH] RadioGroup add vertical props --- src/components/radio/radio-group.vue | 7 ++++++- src/styles/components/radio.less | 11 +++++++++++ test/routers/radio.vue | 5 ++--- test/routers/table.vue | 7 +------ 4 files changed, 20 insertions(+), 10 deletions(-) diff --git a/src/components/radio/radio-group.vue b/src/components/radio/radio-group.vue index bcf638d..12bfc20 100644 --- a/src/components/radio/radio-group.vue +++ b/src/components/radio/radio-group.vue @@ -24,6 +24,10 @@ validator (value) { return oneOf(value, ['button']); } + }, + vertical: { + type: Boolean, + default: false } }, computed: { @@ -32,7 +36,8 @@ `${prefixCls}`, { [`${prefixCls}-${this.size}`]: !!this.size, - [`${prefixCls}-${this.type}`]: !!this.type + [`${prefixCls}-${this.type}`]: !!this.type, + [`${prefixCls}-vertical`]: this.vertical } ]; } diff --git a/src/styles/components/radio.less b/src/styles/components/radio.less index 9838d41..d5e9e8b 100644 --- a/src/styles/components/radio.less +++ b/src/styles/components/radio.less @@ -6,6 +6,13 @@ .@{radio-group-prefix-cls} { display: inline-block; font-size: @font-size-small; + &-vertical{ + .@{radio-prefix-cls}-wrapper { + display: block; + height: 30px; + line-height: 30px; + } + } } // 普通状态 @@ -16,6 +23,10 @@ position: relative; white-space: nowrap; margin-right: 8px; + cursor: pointer; + &-disabled{ + cursor: @cursor-disabled; + } } .@{radio-prefix-cls} { diff --git a/test/routers/radio.vue b/test/routers/radio.vue index 2c3f4d2..9375a79 100644 --- a/test/routers/radio.vue +++ b/test/routers/radio.vue @@ -1,7 +1,6 @@ <template> <div> - <Checkbox>hello</Checkbox> - <Radio-group :model.sync="phone"> + <Radio-group :model.sync="phone" vertical> <Radio value="apple"> <Icon type="social-apple"></Icon> <span>Apple</span> @@ -27,7 +26,7 @@ <i-button @click="radio = !radio">change radio</i-button> <br> <br> - <Radio-group :model.sync="phone" type="button"> + <Radio-group :model.sync="phone" type="button" vertical> <Radio value="apple"> <Icon type="social-apple"></Icon> <span>Apple</span> diff --git a/test/routers/table.vue b/test/routers/table.vue index ed4e3a2..22cfd88 100644 --- a/test/routers/table.vue +++ b/test/routers/table.vue @@ -1,11 +1,6 @@ -<style> - body{ - overflow: hidden; - } -</style> <template> <i-table border :columns="columns1" :data="data1"></i-table> - <i-table border height="200" :columns="columns1" :data="data2"></i-table> + <!--<i-table border height="200" :columns="columns1" :data="data2"></i-table>--> <!--<i-table width="550" height="200" border :columns="columns2" :data="data4"></i-table>--> <!--<i-button @click="changeFilter">改变filter</i-button>--> <!--<span v-if="currentRow !== null">Current Row: {{currentRow.name}}</span>--> -- libgit2 0.21.4