Commit 71d9fc8e455a4539f26a5503fdd7e6caee6eeb7a
1 parent
b88f42eb
Button add new prop 'long'
Button add new prop 'long'
Showing
3 changed files
with
16 additions
and
2 deletions
Show diff stats
src/components/button/button.vue
| @@ -38,7 +38,11 @@ | @@ -38,7 +38,11 @@ | ||
| 38 | return oneOf(value, ['button', 'submit', 'reset']); | 38 | return oneOf(value, ['button', 'submit', 'reset']); |
| 39 | } | 39 | } |
| 40 | }, | 40 | }, |
| 41 | - icon: String | 41 | + icon: String, |
| 42 | + long: { | ||
| 43 | + type: Boolean, | ||
| 44 | + default: false | ||
| 45 | + } | ||
| 42 | }, | 46 | }, |
| 43 | data () { | 47 | data () { |
| 44 | return { | 48 | return { |
| @@ -51,6 +55,7 @@ | @@ -51,6 +55,7 @@ | ||
| 51 | `${prefixCls}`, | 55 | `${prefixCls}`, |
| 52 | { | 56 | { |
| 53 | [`${prefixCls}-${this.type}`]: !!this.type, | 57 | [`${prefixCls}-${this.type}`]: !!this.type, |
| 58 | + [`${prefixCls}-long`]: this.long, | ||
| 54 | [`${prefixCls}-${this.shape}`]: !!this.shape, | 59 | [`${prefixCls}-${this.shape}`]: !!this.shape, |
| 55 | [`${prefixCls}-${this.size}`]: !!this.size, | 60 | [`${prefixCls}-${this.size}`]: !!this.size, |
| 56 | [`${prefixCls}-loading`]: this.loading != null && this.loading, | 61 | [`${prefixCls}-loading`]: this.loading != null && this.loading, |
| @@ -70,7 +75,7 @@ | @@ -70,7 +75,7 @@ | ||
| 70 | ] | 75 | ] |
| 71 | } | 76 | } |
| 72 | }, | 77 | }, |
| 73 | - ready () { | 78 | + compiled () { |
| 74 | this.showSlot = this.$els.slot.innerHTML.replace(/\n/g, '').replace(/<!--[\w\W\r\n]*?-->/gmi, '') !== ''; | 79 | this.showSlot = this.$els.slot.innerHTML.replace(/\n/g, '').replace(/<!--[\w\W\r\n]*?-->/gmi, '') !== ''; |
| 75 | } | 80 | } |
| 76 | } | 81 | } |
src/styles/components/button.less
test/routers/button.vue
| @@ -5,6 +5,11 @@ | @@ -5,6 +5,11 @@ | ||
| 5 | <i-button type="warning">按钮</i-button> | 5 | <i-button type="warning">按钮</i-button> |
| 6 | <i-button type="error">按钮</i-button> | 6 | <i-button type="error">按钮</i-button> |
| 7 | <i-button type="info">按钮</i-button> | 7 | <i-button type="info">按钮</i-button> |
| 8 | + <i-button icon="ios-search" type="success"></i-button> | ||
| 9 | + <br><br> | ||
| 10 | + <div style="width:400px;height:200px;"> | ||
| 11 | + <i-button type="error" long size="small">按钮</i-button> | ||
| 12 | + </div> | ||
| 8 | <br><br> | 13 | <br><br> |
| 9 | <Button-group> | 14 | <Button-group> |
| 10 | <i-button>取消</i-button> | 15 | <i-button>取消</i-button> |