add Radio UI
add Radio UI
This commit is contained in:
parent
e1596b7e2c
commit
4925f85fea
6 changed files with 299 additions and 6 deletions
2
dist/styles/iview.all.css
vendored
2
dist/styles/iview.all.css
vendored
File diff suppressed because one or more lines are too long
2
dist/styles/iview.css
vendored
2
dist/styles/iview.css
vendored
File diff suppressed because one or more lines are too long
|
@ -29,6 +29,51 @@
|
|||
</Collapse>
|
||||
<Button @click="activeKey = '2'">换</Button>
|
||||
</div>
|
||||
<Radio :checked.sync="radio">Radio</Radio>
|
||||
<Button @click="radio = !radio">change radio</Button>
|
||||
<br>
|
||||
<br>
|
||||
<Radio-group :model.sync="phone" type="button">
|
||||
<Radio value="apple">
|
||||
<Icon type="social-apple"></Icon>
|
||||
<span>Apple</span>
|
||||
</Radio>
|
||||
<Radio value="android">
|
||||
<Icon type="social-android"></Icon>
|
||||
<span>Android</span>
|
||||
</Radio>
|
||||
<Radio value="windows">
|
||||
<Icon type="social-windows"></Icon>
|
||||
<span>Windows</span>
|
||||
</Radio>
|
||||
</Radio-group>
|
||||
<Radio-group :model.sync="animal" type="button">
|
||||
<Radio value="金斑蝶"></Radio>
|
||||
<Radio value="爪哇犀牛"></Radio>
|
||||
<Radio value="印度黑羚"></Radio>
|
||||
</Radio-group>
|
||||
|
||||
<Radio-group :model.sync="animal" type="button">
|
||||
<Radio value="金斑蝶" disabled></Radio>
|
||||
<Radio value="爪哇犀牛" disabled></Radio>
|
||||
<Radio value="印度黑羚"></Radio>
|
||||
</Radio-group>
|
||||
<br><br>
|
||||
<Radio-group :model.sync="animal" type="button" size="large">
|
||||
<Radio value="金斑蝶"></Radio>
|
||||
<Radio value="爪哇犀牛"></Radio>
|
||||
<Radio value="印度黑羚"></Radio>
|
||||
</Radio-group>
|
||||
<Radio-group :model.sync="animal" type="button">
|
||||
<Radio value="金斑蝶"></Radio>
|
||||
<Radio value="爪哇犀牛"></Radio>
|
||||
<Radio value="印度黑羚"></Radio>
|
||||
</Radio-group>
|
||||
<Radio-group :model.sync="animal" type="button" size="small">
|
||||
<Radio value="金斑蝶"></Radio>
|
||||
<Radio value="爪哇犀牛"></Radio>
|
||||
<Radio value="印度黑羚"></Radio>
|
||||
</Radio-group>
|
||||
</template>
|
||||
<script>
|
||||
import { Radio, Alert, Icon, Collapse, Button } from 'iview';
|
||||
|
@ -51,9 +96,11 @@
|
|||
},
|
||||
data () {
|
||||
return {
|
||||
radio: true,
|
||||
radio: false,
|
||||
radioGroup: '段模',
|
||||
activeKey: [1,2]
|
||||
activeKey: [1,2],
|
||||
phone: 'apple',
|
||||
animal: '爪哇犀牛'
|
||||
}
|
||||
},
|
||||
computed: {
|
||||
|
|
|
@ -1,6 +1,6 @@
|
|||
{
|
||||
"name": "iview",
|
||||
"version": "0.0.11",
|
||||
"version": "0.0.12",
|
||||
"title": "iView",
|
||||
"description": "A high quality UI components Library with Vue.js",
|
||||
"homepage": "http://www.iviewui.com",
|
||||
|
|
|
@ -9,3 +9,4 @@
|
|||
@import "card";
|
||||
@import "message";
|
||||
@import "notice";
|
||||
@import "radio";
|
245
styles/components/radio.less
Normal file
245
styles/components/radio.less
Normal file
|
@ -0,0 +1,245 @@
|
|||
@radio-prefix-cls: ~"@{css-prefix}radio";
|
||||
@radio-group-prefix-cls: ~"@{radio-prefix-cls}-group";
|
||||
@radio-inner-prefix-cls: ~"@{radio-prefix-cls}-inner";
|
||||
@radio-group-button-prefix-cls: ~"@{radio-group-prefix-cls}-button";
|
||||
|
||||
.@{radio-group-prefix-cls} {
|
||||
display: inline-block;
|
||||
font-size: @font-size-base;
|
||||
}
|
||||
|
||||
// 普通状态
|
||||
.@{radio-prefix-cls}-wrapper {
|
||||
font-size: @font-size-base;
|
||||
vertical-align: middle;
|
||||
display: inline-block;
|
||||
position: relative;
|
||||
white-space: nowrap;
|
||||
margin-right: 8px;
|
||||
}
|
||||
|
||||
.@{radio-prefix-cls} {
|
||||
white-space: nowrap;
|
||||
outline: none;
|
||||
display: inline-block;
|
||||
position: relative;
|
||||
line-height: 1;
|
||||
vertical-align: middle;
|
||||
cursor: pointer;
|
||||
&:hover {
|
||||
.@{radio-inner-prefix-cls} {
|
||||
border-color: #bcbcbc;
|
||||
}
|
||||
}
|
||||
&-inner {
|
||||
display: inline-block;
|
||||
width: 16px;
|
||||
height: 16px;
|
||||
position: relative;
|
||||
top: 0;
|
||||
left: 0;
|
||||
background-color: #fff;
|
||||
border: 1px solid @border-color-base;
|
||||
border-radius: 50%;
|
||||
.transition(all @animation-time @ease-in-out);
|
||||
|
||||
&:after {
|
||||
position: absolute;
|
||||
width: 10px;
|
||||
height: 10px;
|
||||
left: 2px;
|
||||
top: 2px;
|
||||
border-radius: @border-radius-base;
|
||||
display: table;
|
||||
border-top: 0;
|
||||
border-left: 0;
|
||||
content: ' ';
|
||||
background-color: @primary-color;
|
||||
opacity: 0;
|
||||
.transition(all @animation-time @ease-in-out);
|
||||
.transform(scale(0));
|
||||
}
|
||||
}
|
||||
|
||||
&-input {
|
||||
position: absolute;
|
||||
top: 0;
|
||||
bottom: 0;
|
||||
left: 0;
|
||||
right: 0;
|
||||
z-index: 1;
|
||||
cursor: pointer;
|
||||
opacity: 0;
|
||||
}
|
||||
}
|
||||
|
||||
// 选中状态
|
||||
.@{radio-prefix-cls}-checked {
|
||||
.@{radio-inner-prefix-cls} {
|
||||
border-color: @border-color-base;
|
||||
&:after {
|
||||
opacity: 1;
|
||||
.transform(scale(1));
|
||||
.transition(all @animation-time @ease-in-out);
|
||||
}
|
||||
}
|
||||
}
|
||||
|
||||
.@{radio-prefix-cls}-disabled {
|
||||
&:hover {
|
||||
.@{radio-inner-prefix-cls} {
|
||||
border-color: @border-color-base;
|
||||
}
|
||||
}
|
||||
.@{radio-inner-prefix-cls} {
|
||||
border-color: @border-color-base;
|
||||
background-color: #f3f3f3;
|
||||
&:after {
|
||||
background-color: #cccccc;
|
||||
}
|
||||
}
|
||||
|
||||
.@{radio-inner-prefix-cls}-input {
|
||||
cursor: default;
|
||||
}
|
||||
|
||||
.@{radio-prefix-cls}-disabled + span {
|
||||
color: #ccc;
|
||||
cursor: @cursor-disabled;
|
||||
}
|
||||
}
|
||||
|
||||
span.@{radio-prefix-cls} + * {
|
||||
margin-left: 2px;
|
||||
margin-right: 2px;
|
||||
}
|
||||
|
||||
// 按钮样式
|
||||
.@{radio-group-button-prefix-cls} {
|
||||
font-size: 0;
|
||||
-webkit-text-size-adjust:none;
|
||||
|
||||
.@{radio-prefix-cls}-wrapper {
|
||||
font-size: 14px;
|
||||
margin: 0;
|
||||
height: 28px;
|
||||
line-height: 26px;
|
||||
color: @btn-default-color;
|
||||
display: inline-block;
|
||||
.transition(all @animation-time ease-in-out);
|
||||
cursor: pointer;
|
||||
border: 1px solid @border-color-base;
|
||||
border-left: 0;
|
||||
background: #fff;
|
||||
padding: 0 16px;
|
||||
|
||||
> span {
|
||||
margin-left: 0;
|
||||
}
|
||||
|
||||
&:before {
|
||||
content: '';
|
||||
position: absolute;
|
||||
width: 1px;
|
||||
height: 100%;
|
||||
left: -1px;
|
||||
background: @border-color-base;
|
||||
visibility: hidden;
|
||||
.transition(all @animation-time ease-in-out);
|
||||
}
|
||||
|
||||
&:first-child {
|
||||
border-radius: @btn-border-radius 0 0 @btn-border-radius;
|
||||
border-left: 1px solid @border-color-base;
|
||||
&:before {
|
||||
display: none;
|
||||
}
|
||||
}
|
||||
|
||||
&:last-child {
|
||||
border-radius: 0 @btn-border-radius @btn-border-radius 0;
|
||||
}
|
||||
|
||||
&:first-child:last-child {
|
||||
border-radius: @btn-border-radius;
|
||||
}
|
||||
|
||||
&:hover {
|
||||
position: relative;
|
||||
color: @primary-color;
|
||||
}
|
||||
|
||||
.@{radio-prefix-cls}-inner,
|
||||
input {
|
||||
opacity: 0;
|
||||
width: 0;
|
||||
height: 0;
|
||||
}
|
||||
|
||||
&-checked {
|
||||
background: #fff;
|
||||
border-color: @primary-color;
|
||||
color: @primary-color;
|
||||
box-shadow: -1px 0 0 0 @primary-color;
|
||||
|
||||
&:first-child {
|
||||
border-color: @primary-color;
|
||||
box-shadow: none!important;
|
||||
}
|
||||
|
||||
&:hover {
|
||||
border-color: tint(@primary-color, 20%);
|
||||
box-shadow: -1px 0 0 0 tint(@primary-color, 20%);
|
||||
color: tint(@primary-color, 20%);
|
||||
}
|
||||
|
||||
&:active {
|
||||
border-color: shade(@primary-color, 5%);
|
||||
box-shadow: -1px 0 0 0 shade(@primary-color, 5%);
|
||||
color: shade(@primary-color, 5%);
|
||||
}
|
||||
}
|
||||
|
||||
&-disabled {
|
||||
border-color: @border-color-base;
|
||||
background-color: @background-color-base;
|
||||
cursor: not-allowed;
|
||||
color: #ccc;
|
||||
|
||||
&:first-child,
|
||||
&:hover {
|
||||
border-color: @border-color-base;
|
||||
background-color: @background-color-base;
|
||||
color: #ccc;
|
||||
}
|
||||
&:first-child {
|
||||
border-left-color: @border-color-base;
|
||||
}
|
||||
}
|
||||
|
||||
&-disabled.@{radio-prefix-cls}-wrapper-checked {
|
||||
color: #fff;
|
||||
background-color: #e6e6e6;
|
||||
border-color: @border-color-base;
|
||||
box-shadow: none!important;
|
||||
}
|
||||
}
|
||||
}
|
||||
|
||||
.@{radio-group-button-prefix-cls}.@{radio-group-prefix-cls}-large .@{radio-prefix-cls}-wrapper{
|
||||
height: 32px;
|
||||
line-height: 30px;
|
||||
}
|
||||
|
||||
.@{radio-group-button-prefix-cls}.@{radio-group-prefix-cls}-small .@{radio-prefix-cls}-wrapper{
|
||||
height: 22px;
|
||||
line-height: 20px;
|
||||
padding: 0 12px;
|
||||
font-size: 12px;
|
||||
&:first-child {
|
||||
border-radius: @btn-border-radius 0 0 @btn-border-radius-small;
|
||||
}
|
||||
&:last-child {
|
||||
border-radius: 0 @btn-border-radius-small @btn-border-radius 0;
|
||||
}
|
||||
}
|
Loading…
Add table
Reference in a new issue