feat(button): attr-type prop to set type attr

This commit is contained in:
07akioni 2020-06-06 00:03:44 +08:00
parent e67a2b65e9
commit 90ed52aee4
3 changed files with 9 additions and 0 deletions

View File

@ -18,6 +18,7 @@ group
### Button Props
|Name|Type|Default|Description|
|-|-|-|-|
|attr-type|`'button' \| 'submit' \| 'reset'`|`'button'`|The DOM `type` attribute of the button.|
|block|`boolean`|`false`||
|circle|`boolean`|`false`||
|color|`string`|`null`|Only support `#FFF`, `#FFFFFF`, `rgb(0, 0, 0)` formatted colors.|

View File

@ -19,6 +19,7 @@ debug
### Button Props
|名称|类型|默认值|说明|
|-|-|-|-|
|attr-type|`'button' \| 'submit' \| 'reset'`|`'button'`|按钮的 DOM `type` 属性|
|block|`boolean`|`false`||
|circle|`boolean`|`false`||
|color|`string`|`null`|只支持形如 `#FFF`, `#FFFFFF`, `rgb(0, 0, 0)` 的颜色|

View File

@ -24,6 +24,7 @@
[`n-${syntheticTheme}-theme`]: syntheticTheme,
}"
:tabindex="syntheticFocusable ? 0 : -1"
:type="attrType"
@click="handleClick"
@blur="handleBlur"
@mousedown="handleMouseDown"
@ -236,6 +237,12 @@ export default {
validator (value) {
return ['secondary', 'tertiary'].includes(value)
}
},
attrType: {
default: 'button',
validator (value) {
return ['button', 'submit', 'reset'].includes(value)
}
}
},
data () {