mirror of
https://github.com/tusen-ai/naive-ui.git
synced 2024-12-09 04:31:35 +08:00
feat(button-group): size
This commit is contained in:
parent
1b1f43328e
commit
577104b11f
@ -1,7 +1,7 @@
|
||||
# Button Group
|
||||
Button can be grouped.
|
||||
```html
|
||||
<n-button-group>
|
||||
<n-button-group size="small">
|
||||
<n-button
|
||||
type="default"
|
||||
round
|
||||
|
@ -17,9 +17,10 @@ debug
|
||||
### Button Props
|
||||
|Name|Type|Default|Description|
|
||||
|-|-|-|-|
|
||||
|size|`'small' \| 'medium' \| 'large'`|`'medium'`
|
||||
|size|`'small' \| 'medium' \| 'large'`|`'medium'`||
|
||||
|type|`'default' \| 'primary' \| 'success' \| 'info' \| 'warning' \| 'error'`|`'default'`||
|
||||
|text|`boolean`|`false`||
|
||||
|block|`boolean`|`false`||
|
||||
|ghost|`boolean`|`false`||
|
||||
|disabled|`boolean`|`false`||
|
||||
|circle|`boolean`|`false`||
|
||||
@ -30,6 +31,7 @@ debug
|
||||
### Button Group Props
|
||||
|Name|Type|Default|Description|
|
||||
|-|-|-|-|
|
||||
|size|`'small' \| 'medium' \| 'large'`|`null`|The buttons' size in button group. If set, the button's size prop inner group won't work.|
|
||||
|vertical|`boolean`|`false`||
|
||||
|
||||
## Slots
|
||||
|
@ -1,7 +1,7 @@
|
||||
# 按钮组
|
||||
可以把几个按钮结合成按钮组。
|
||||
```html
|
||||
<n-button-group>
|
||||
<n-button-group size="small">
|
||||
<n-button
|
||||
type="default"
|
||||
round
|
||||
|
@ -17,9 +17,10 @@ debug
|
||||
### Button Props
|
||||
|名称|类型|默认值|说明|
|
||||
|-|-|-|-|
|
||||
|size|`'small' \| 'medium' \| 'large'`|`'medium'`
|
||||
|size|`'small' \| 'medium' \| 'large'`|`'medium'`||
|
||||
|type|`'default' \| 'primary' \| 'success' \| 'info' \| 'warning' \| 'error'`|`'default'`||
|
||||
|text|`boolean`|`false`||
|
||||
|block|`boolean`|`false`||
|
||||
|ghost|`boolean`|`false`||
|
||||
|disabled|`boolean`|`false`||
|
||||
|circle|`boolean`|`false`||
|
||||
@ -30,6 +31,7 @@ debug
|
||||
### Button Group Props
|
||||
|名称|类型|默认值|说明|
|
||||
|-|-|-|-|
|
||||
|size|`'small' \| 'medium' \| 'large'`|`'medium'`|在组内的按钮的尺寸。如果设定,内部的按钮尺寸将不生效|
|
||||
|vertical|`boolean`|`false`||
|
||||
|
||||
## Slots
|
||||
|
@ -5,7 +5,7 @@
|
||||
'n-button--round': round,
|
||||
'n-button--circle': circle,
|
||||
[`n-button--${type}-type`]: true,
|
||||
[`n-button--${size}-size`]: true,
|
||||
[`n-button--${synthesizedSize}-size`]: true,
|
||||
'n-button--disabled': disabled,
|
||||
'n-button--loading': loading,
|
||||
'n-button--block': block,
|
||||
@ -121,6 +121,11 @@ export default {
|
||||
NIconSwitchTransition,
|
||||
NFadeInHeightExpandTransition
|
||||
},
|
||||
inject: {
|
||||
NButtonGroup: {
|
||||
default: null
|
||||
}
|
||||
},
|
||||
mixins: [withapp, themeable, hollowoutable],
|
||||
props: {
|
||||
text: {
|
||||
@ -194,6 +199,12 @@ export default {
|
||||
}
|
||||
},
|
||||
computed: {
|
||||
synthesizedSize () {
|
||||
if (this.NButtonGroup && this.NButtonGroup.size) {
|
||||
return this.NButtonGroup.size
|
||||
}
|
||||
return this.size
|
||||
},
|
||||
noTextContent () {
|
||||
return this.circle || !this.$slots.default
|
||||
},
|
||||
|
@ -13,10 +13,15 @@
|
||||
<script>
|
||||
export default {
|
||||
name: 'NButtonGroup',
|
||||
provide () {
|
||||
return {
|
||||
NButtonGroup: this
|
||||
}
|
||||
},
|
||||
props: {
|
||||
block: {
|
||||
type: Boolean,
|
||||
default: false
|
||||
size: {
|
||||
type: String,
|
||||
default: null
|
||||
},
|
||||
vertical: {
|
||||
type: Boolean,
|
||||
|
Loading…
Reference in New Issue
Block a user