From ac2f477e44dc5a8674fdfe7fab6c7f7954f6dde7 Mon Sep 17 00:00:00 2001 From: baimin Date: Wed, 2 Sep 2020 15:44:20 +0800 Subject: [PATCH] =?UTF-8?q?feat(button):=20=E6=B7=BB=E5=8A=A0validator?= =?UTF-8?q?=E7=B1=BB=E5=9E=8B=E6=A0=A1=E9=AA=8C?= MIME-Version: 1.0 Content-Type: text/plain; charset=UTF-8 Content-Transfer-Encoding: 8bit --- packages/button/src/button.vue | 17 +++++++++++++++++ 1 file changed, 17 insertions(+) diff --git a/packages/button/src/button.vue b/packages/button/src/button.vue index 1cfc45aa06..d5fbed61d4 100644 --- a/packages/button/src/button.vue +++ b/packages/button/src/button.vue @@ -68,10 +68,24 @@ export default defineComponent({ type: { type: String as IButtonType, default: 'default', + validator: (val: string) => { + return [ + '', + 'primary', + 'success', + 'warning', + 'info', + 'danger', + 'text', + ].includes(val) + }, }, size: { type: String as IButtonType, default: '', + validator: (val: string) => { + return ['', 'medium', 'small', 'mini'].includes(val) + }, }, icon: { type: String, @@ -80,6 +94,9 @@ export default defineComponent({ nativeType: { type: String as IButtonNativeType, default: 'button', + validator: (val: string) => { + return ['button', 'submit', 'reset'].includes(val) + }, }, loading: Boolean, disabled: Boolean,