mirror of
https://gitee.com/vant-contrib/vant-weapp.git
synced 2025-04-05 19:41:45 +08:00
* perf: remove CSS variables polyfill * style: fix missing calc value * perf: reduce some useless css vars
218 lines
5.1 KiB
Plaintext
218 lines
5.1 KiB
Plaintext
@import '../common/style/var.less';
|
||
|
||
.van-button {
|
||
position: relative;
|
||
display: inline-flex;
|
||
align-items: center;
|
||
justify-content: center;
|
||
box-sizing: border-box;
|
||
padding: 0;
|
||
text-align: center;
|
||
vertical-align: middle;
|
||
-webkit-appearance: none;
|
||
-webkit-text-size-adjust: 100%;
|
||
height: var(--button-default-height, @button-default-height);
|
||
line-height: var(--button-line-height, @button-line-height);
|
||
font-size: var(--button-default-font-size, @button-default-font-size);
|
||
transition: opacity @animation-duration-fast;
|
||
border-radius: var(--button-border-radius, @button-border-radius);
|
||
|
||
&::before {
|
||
position: absolute;
|
||
top: 50%;
|
||
left: 50%;
|
||
width: 100%;
|
||
height: 100%;
|
||
border: inherit;
|
||
border-radius: inherit; /* inherit parent's border radius */
|
||
transform: translate(-50%, -50%);
|
||
opacity: 0;
|
||
content: ' ';
|
||
background-color: @black;
|
||
border-color: @black;
|
||
}
|
||
|
||
// reset weapp default border
|
||
&::after {
|
||
border-width: 0;
|
||
}
|
||
|
||
&--active::before {
|
||
opacity: 0.15;
|
||
}
|
||
|
||
&--unclickable::after {
|
||
display: none;
|
||
}
|
||
|
||
&--default {
|
||
color: var(--button-default-color, @button-default-color);
|
||
background: var(
|
||
--button-default-background-color,
|
||
@button-default-background-color
|
||
);
|
||
border: var(--button-border-width, @button-border-width) solid
|
||
var(--button-default-border-color, @button-default-border-color);
|
||
}
|
||
|
||
&--primary {
|
||
color: var(--button-primary-color, @button-primary-color);
|
||
background: var(
|
||
--button-primary-background-color,
|
||
@button-primary-background-color
|
||
);
|
||
border: var(--button-border-width, @button-border-width) solid
|
||
var(--button-primary-border-color, @button-primary-border-color);
|
||
}
|
||
|
||
&--info {
|
||
color: var(--button-info-color, @button-info-color);
|
||
background: var(
|
||
--button-info-background-color,
|
||
@button-info-background-color
|
||
);
|
||
border: var(--button-border-width, @button-border-width) solid
|
||
var(--button-info-border-color, @button-info-border-color);
|
||
}
|
||
|
||
&--danger {
|
||
color: var(--button-danger-color, @button-danger-color);
|
||
background: var(
|
||
--button-danger-background-color,
|
||
@button-danger-background-color
|
||
);
|
||
border: var(--button-border-width, @button-border-width) solid
|
||
var(--button-danger-border-color, @button-danger-border-color);
|
||
}
|
||
|
||
&--warning {
|
||
color: var(--button-warning-color, @button-warning-color);
|
||
background: var(
|
||
--button-warning-background-color,
|
||
@button-warning-background-color
|
||
);
|
||
border: var(--button-border-width, @button-border-width) solid
|
||
var(--button-warning-border-color, @button-warning-border-color);
|
||
}
|
||
|
||
&--plain {
|
||
background: var(
|
||
--button-plain-background-color,
|
||
@button-plain-background-color
|
||
);
|
||
|
||
&.van-button--primary {
|
||
color: var(
|
||
--button-primary-background-color,
|
||
@button-primary-background-color
|
||
);
|
||
}
|
||
|
||
&.van-button--info {
|
||
color: var(--button-info-background-color, @button-info-background-color);
|
||
}
|
||
|
||
&.van-button--danger {
|
||
color: var(
|
||
--button-danger-background-color,
|
||
@button-danger-background-color
|
||
);
|
||
}
|
||
|
||
&.van-button--warning {
|
||
color: var(
|
||
--button-warning-background-color,
|
||
@button-warning-background-color
|
||
);
|
||
}
|
||
}
|
||
|
||
&--large {
|
||
width: 100%;
|
||
height: var(--button-large-height, @button-large-height);
|
||
}
|
||
|
||
&--normal {
|
||
padding: 0 15px;
|
||
font-size: var(--button-normal-font-size, @button-normal-font-size);
|
||
}
|
||
|
||
&--small {
|
||
min-width: var(--button-small-min-width, @button-small-min-width);
|
||
height: var(--button-small-height, @button-small-height);
|
||
padding: 0 var(--padding-xs, @padding-xs);
|
||
font-size: var(--button-small-font-size, @button-small-font-size);
|
||
}
|
||
|
||
// mini图标默认宽度50px,文字不能超过4个
|
||
&--mini {
|
||
display: inline-block;
|
||
min-width: var(--button-mini-min-width, @button-mini-min-width);
|
||
height: var(--button-mini-height, @button-mini-height);
|
||
font-size: var(--button-mini-font-size, @button-mini-font-size);
|
||
|
||
& + .van-button--mini {
|
||
margin-left: 5px;
|
||
}
|
||
}
|
||
|
||
&--block {
|
||
display: flex;
|
||
width: 100%;
|
||
}
|
||
|
||
&--round {
|
||
border-radius: var(
|
||
--button-round-border-radius,
|
||
@button-round-border-radius
|
||
);
|
||
}
|
||
|
||
&--square {
|
||
border-radius: 0;
|
||
}
|
||
|
||
&--disabled {
|
||
opacity: var(--button-disabled-opacity, @button-disabled-opacity);
|
||
}
|
||
|
||
&__text {
|
||
display: inline;
|
||
}
|
||
|
||
&__loading-text,
|
||
&__icon + &__text:not(:empty) {
|
||
margin-left: @padding-base;
|
||
}
|
||
|
||
&__icon {
|
||
min-width: 1em;
|
||
line-height: inherit !important;
|
||
vertical-align: top;
|
||
}
|
||
|
||
&--hairline {
|
||
padding-top: 1px; // add 1px padding for text vertical align middle
|
||
border-width: 0;
|
||
|
||
&::after {
|
||
border-color: inherit;
|
||
border-width: 1px;
|
||
border-radius: calc(
|
||
var(--button-border-radius, @button-border-radius) * 2
|
||
);
|
||
}
|
||
|
||
&.van-button--round::after {
|
||
border-radius: var(
|
||
--button-round-border-radius,
|
||
@button-round-border-radius
|
||
);
|
||
}
|
||
|
||
&.van-button--square::after {
|
||
border-radius: 0;
|
||
}
|
||
}
|
||
}
|