feat(button): bordered prop

This commit is contained in:
07akioni 2021-04-03 15:17:52 +08:00
parent 12b97ab79c
commit 7d15f230b0
5 changed files with 14 additions and 2 deletions

View File

@ -7,6 +7,7 @@
- Add `n-page-header` component.
- `n-statistic` add `label` slot.
- `n-breadcrumb-item` add `separator` slot & prop.
- `n-button` add `bordered` prop.
### Refactors

View File

@ -7,6 +7,7 @@
- 添加 `n-page-header` 组件
- `n-statistic` 增加 `label` slot
- `n-breadcrumb-item` 增加 `separator` slot & prop
- `n-button` 增加 `bordered` prop
### Refactors

View File

@ -27,6 +27,7 @@ group
| --- | --- | --- | --- |
| attr-type | `'button' \| 'submit' \| 'reset'` | `'button'` | The DOM `type` attribute of the button. |
| block | `boolean` | `false` | |
| bordered | `boolean` | `true` | |
| circle | `boolean` | `false` | |
| color | `string` | `undefined` | Only support `#FFF`, `#FFFFFF`, `rgb(0, 0, 0)` formatted colors. |
| dashed | `boolean` | `false` | |

View File

@ -28,6 +28,7 @@ debug
| --- | --- | --- | --- |
| attr-type | `'button' \| 'submit' \| 'reset'` | `'button'` | 按钮的 DOM `type` 属性 |
| block | `boolean` | `false` | |
| bordered | `boolean` | `true` | |
| circle | `boolean` | `false` | |
| color | `string` | `undefined` | 只支持形如 `#FFF`, `#FFFFFF`, `rgb(0, 0, 0)` 的颜色 |
| dashed | `boolean` | `false` | |

View File

@ -86,14 +86,22 @@ export default defineComponent({
type: String as PropType<'button' | 'submit' | 'reset'>,
default: 'button'
},
onClick: [Function, Array] as PropType<MaybeArray<(e: MouseEvent) => void>>
onClick: [Function, Array] as PropType<MaybeArray<(e: MouseEvent) => void>>,
bordered: {
type: Boolean,
default: true
}
},
setup (props) {
const selfRef = ref<HTMLElement | null>(null)
const waveRef = ref<BaseWaveRef | null>(null)
const enterPressedRef = ref(false)
const showBorderRef = useMemo(() => {
return !props.text && (!props.color || props.ghost || props.dashed)
return (
!props.text &&
(!props.color || props.ghost || props.dashed) &&
props.bordered
)
})
const NButtonGroup = inject<ButtonGroupInjection>('NButtonGroup', {})
const { mergedSize: mergedSizeRef } = useFormItem(