diff --git a/examples/views/docs/component/button.md b/examples/views/docs/component/button.md index 981eacc..d9630f9 100644 --- a/examples/views/docs/component/button.md +++ b/examples/views/docs/component/button.md @@ -126,6 +126,13 @@ Ghost Link +
+ 渐变 + 渐变 + 渐变 + 渐变 + 渐变 +
``` @@ -220,10 +227,14 @@ export default { 参数|说明|类型|可选值|默认值 -|-|-|-|- type | 按钮类型 | String | default,primary,secondary | default +size | 按钮大小 | String | ms,md,lg | md block | 块状按钮 | Boolean | true,false | false round | 圆角按钮 | Boolean | true,false | false square | 矩形按钮 | Boolean | true,false | false disabled | 按钮禁用 | Boolean | true,false | false +theme | 按钮主题 | String | red,green,blue | - +color | 按钮颜色 | String | - | - +fontColor | 按钮文本颜色,只在color为linear-gradient模式下生效 | String | - | #FFF ## Events 事件 diff --git a/packages/button/index.vue b/packages/button/index.vue index c233cf4..8111079 100644 --- a/packages/button/index.vue +++ b/packages/button/index.vue @@ -29,6 +29,10 @@ export default { disabled: Boolean, theme: String, color: String, + fontColor: { + type: String, + default: '#FFF', + }, }, computed: { classRender() { @@ -46,6 +50,14 @@ export default { }, styleRender() { if (this.color) { + if (this.color.includes('linear-gradient')) { + return { + color: this.fontColor, + background: this.color, + border: 'none', + opacity: this.hover ? 0.9 : 1, + }; + } if (this.type === 'primary') { return { backgroundColor: this.hover ? color(this.color).lighten(0.2) : this.color, -- libgit2 0.21.0