diff --git a/examples/views/docs/component/button.md b/examples/views/docs/component/button.md
index 4e8e71c..29952bb 100644
--- a/examples/views/docs/component/button.md
+++ b/examples/views/docs/component/button.md
@@ -178,6 +178,8 @@
默认按钮
圆角按钮
矩形按钮
+ 圆
+
```
diff --git a/packages/button/index.scss b/packages/button/index.scss
index 39d31af..491828b 100644
--- a/packages/button/index.scss
+++ b/packages/button/index.scss
@@ -1,13 +1,8 @@
.zui-button {
- color: #323233;
- background-color: #fff;
- padding: $h-gap-md $v-gap-md;
- font-size: $font-md;
- font-weight: normal;
+ color: $color-text;
+ background-color: $color-white;
cursor: pointer;
- transition: all 70ms ease;
border-radius: 0.35rem;
- position: relative;
display: inline-flex;
align-items: center;
justify-content: center;
@@ -16,6 +11,7 @@
line-height: 1.5;
box-sizing: border-box;
border: 1px solid transparent;
+ vertical-align: middle;
&__icon {
padding-right: 0.25rem;
}
@@ -36,16 +32,37 @@
padding: $h-gap-sm $v-gap-sm;
font-size: $font-sm;
height: $font-sm * 3;
+ &.circle {
+ height: $font-sm * 3;
+ width: $font-sm * 3;
+ .zui-icon {
+ font-size: $font-md;
+ }
+ }
}
&.md {
padding: $h-gap-md $v-gap-md;
font-size: $font-md;
height: $font-md * 3;
+ &.circle {
+ height: $font-md * 3;
+ width: $font-md * 3;
+ .zui-icon {
+ font-size: $font-lg;
+ }
+ }
}
&.lg {
padding: $h-gap-lg $v-gap-lg;
font-size: $font-lg;
height: $font-lg * 3;
+ &.circle {
+ height: $font-lg * 3;
+ width: $font-lg * 3;
+ .zui-icon {
+ font-size: $font-lg * 1.5;
+ }
+ }
}
&.default {
border-color: $color-border;
@@ -166,4 +183,12 @@
&.square {
border-radius: 0;
}
+ &.circle {
+ border-radius: 50%;
+ overflow: hidden;
+ line-height: 1;
+ .zui-button__icon {
+ padding-right: 0;
+ }
+ }
}
\ No newline at end of file
diff --git a/packages/button/index.vue b/packages/button/index.vue
index 2ec0c49..ada3775 100644
--- a/packages/button/index.vue
+++ b/packages/button/index.vue
@@ -29,6 +29,7 @@ export default {
},
icon: [String, Object],
round: Boolean,
+ circle: Boolean,
square: Boolean,
theme: String,
color: String,
@@ -47,6 +48,7 @@ export default {
disabled: this.disabled,
block: this.block,
round: this.round,
+ circle: this.circle,
square: this.square,
custom: !!this.color,
};
@@ -70,33 +72,27 @@ export default {
opacity: this.isHover ? 0.9 : 1,
};
}
- if (this.type === 'primary') {
- return {
+ const config = {
+ primary: {
backgroundColor: this.isHover ? color(this.color).lighten(0.2) : this.color,
borderColor: this.isHover ? color(this.color).lighten(0.2) : this.color,
- };
- } else if (this.type === 'secondary') {
- return {
+ },
+ secondary: {
backgroundColor: this.isHover ? color(this.color).lightness(90) : color(this.color).lightness(95),
color: this.color,
- };
- } else if (this.type === 'plain') {
- return {
+ },
+ plain: {
borderColor: this.color,
color: this.color,
backgroundColor: this.isHover ? color(this.color).lightness(90) : color(this.color).lightness(95),
- };
- } else if (this.type === 'ghost') {
- return {
+ },
+ ghost: {
borderColor: this.color,
color: this.color,
backgroundColor: this.isHover ? color(this.color).lightness(95) : undefined,
- };
- } else {
- return {
- color: this.isHover ? color(this.color).lighten(0.2) : this.color,
- };
- }
+ },
+ };
+ return config[this.type] || { color: this.isHover ? color(this.color).lighten(0.2) : this.color };
}
return {};
},
--
libgit2 0.21.0