按钮新增类型,layout补全文档

This commit is contained in:
niunai
2017-03-30 14:23:36 +08:00
parent 7bbb53e5f5
commit 874df43df0
9 changed files with 150 additions and 41 deletions
+12 -10
View File
@@ -21,6 +21,7 @@ export default {
disabled: Boolean,
loading: Boolean,
block: Boolean,
bottomAction: Boolean,
tag: {
type: String,
default: 'button'
@@ -49,8 +50,8 @@ export default {
},
render(h) {
let { type, nativeType, size, disabled, loading, block } = this;
let Tag = this.tag;
const { type, nativeType, size, disabled, loading, block, bottomAction } = this;
const Tag = this.tag;
return (
<Tag
@@ -63,19 +64,20 @@ export default {
{
'zan-button--disabled': disabled,
'zan-button--loading': loading,
'zan-button--block': block
'zan-button--block': block,
'zan-button--bottom-action': bottomAction
}
]}
onClick={this.handleClick}
>
{
loading ?
<zan-loading
class="zan-button__icon-loading"
type="circle"
color={type === 'default' ? 'black' : 'white'}>
</zan-loading> :
null
loading
? <zan-loading
class="zan-button__icon-loading"
type="circle"
color={type === 'default' ? 'black' : 'white'}>
</zan-loading>
: null
}
<span class="zan-button__text">{this.$slots.default}</span>
</Tag>
+3 -2
View File
@@ -76,8 +76,9 @@ export default {
this.$emit('change', val);
},
value(val) {
if (val) {
this.currentValue = this.correctValue(+val);
val = this.correctValue(+val);
if (val !== this.currentValue) {
this.currentValue = val;
}
}
},
+20 -13
View File
@@ -9,7 +9,6 @@
height: 45px;
line-height: 43px;
border-radius: 4px;
border: 0;
box-sizing: border-box;
font-size: 16px;
text-align: center;
@@ -28,12 +27,11 @@
opacity: .3;
}
& + .zan-button {
margin-left: 10px;
}
& + .zan-button--block {
margin-left: 0;
@e icon-loading {
display: inline-block;
width: 16px;
height: 16px;
vertical-align: middle;
}
@m default {
@@ -62,7 +60,7 @@
}
@m normal {
padding: 0 10px;
padding: 0 15px;
font-size: 14px;
}
@@ -105,11 +103,20 @@
}
}
@e icon-loading {
display: inline-block;
width: 16px;
height: 16px;
vertical-align: middle;
@m bottom-action {
width: 100%;
height: 50px;
line-height: 50px;
border: 0;
border-radius: 0;
background-color: $bottom-action-button-default-background-color;
color: $bottom-action-button-default-color;
font-size: 16px;
&.zan-button--primary {
background-color: $bottom-action-button-primary-background-color;
color: $bottom-action-button-primary-color;
}
}
}
}
+6
View File
@@ -32,3 +32,9 @@ $button-danger-border-color: #e33;
$button-disabled-color: $c-gray-dark;
$button-disabled-background-color: $c-gray-light;
$button-disabled-border-color: #cacaca;
$bottom-action-button-default-color: $c-white;
$bottom-action-button-default-background-color: #f85;
$bottom-action-button-primary-color: $c-white;
$bottom-action-button-primary-background-color: #f44;