-
+
@@ -11,7 +11,7 @@
- 提交
+ 校验
@@ -33,6 +33,7 @@ import {
} from '@opentiny/vue'
import { iconWarningTriangle } from '@opentiny/vue-icon'
+const ruleFormRef = ref()
const design = {
name: 'x-design', // 设计规范名称
version: '1.0.0', // 设计规范版本号
@@ -44,7 +45,8 @@ const design = {
},
Button: {
props: {
- resetTime: 0
+ resetTime: 0,
+ round: true
}
},
Alert: {
@@ -72,6 +74,10 @@ const design = {
}
}
+const handleSubmitPromise = () => {
+ ruleFormRef.value.validate()
+}
+
const formData = ref({
name: '',
age: ''
diff --git a/examples/sites/demos/pc/app/config-provider/base.vue b/examples/sites/demos/pc/app/config-provider/base.vue
index a92c1c1e6b..d3a7a8ec92 100644
--- a/examples/sites/demos/pc/app/config-provider/base.vue
+++ b/examples/sites/demos/pc/app/config-provider/base.vue
@@ -3,7 +3,7 @@
-
+
@@ -11,7 +11,7 @@
- 提交
+ 校验
@@ -55,7 +55,8 @@ export default {
},
Button: {
props: {
- resetTime: 0
+ resetTime: 0,
+ round: true
}
},
Alert: {
@@ -87,6 +88,11 @@ export default {
age: ''
}
}
+ },
+ methods: {
+ handleSubmitPromise() {
+ this.$refs.ruleFormRef.validate()
+ }
}
}
diff --git a/examples/sites/demos/pc/app/config-provider/webdoc/config-provider.js b/examples/sites/demos/pc/app/config-provider/webdoc/config-provider.js
index ce7208c864..314e8e3ed6 100644
--- a/examples/sites/demos/pc/app/config-provider/webdoc/config-provider.js
+++ b/examples/sites/demos/pc/app/config-provider/webdoc/config-provider.js
@@ -10,7 +10,7 @@ export default {
},
desc: {
'zh-CN':
- '可通过 design
属性设置自定义不同设计规范的图标和逻辑,例如:全局配置 Form 表单组件的必填星号是否默认显示、Button 组件的点击后的禁用时间。',
+ '可通过 design
属性设置自定义不同设计规范的图标和逻辑,例如:全局配置 Form 表单组件的必填星号是否默认显示、Button 组件的点击后的禁用时间和是否默认圆角。',
'en-US':
'Icons and logic for different design specifications can be customized through the design
attribute configuration.'
},
diff --git a/packages/renderless/src/button/vue.ts b/packages/renderless/src/button/vue.ts
index 93fa7fa95f..f2e0fffdd4 100644
--- a/packages/renderless/src/button/vue.ts
+++ b/packages/renderless/src/button/vue.ts
@@ -26,6 +26,7 @@ export const renderless = (
timer: 0,
disabled: props.disabled,
plain: computed(() => props.plain || (parent.buttonGroup || {}).plain),
+ round: computed(() => props.round ?? designConfig?.props?.round ?? false),
formDisabled: computed(() => (parent.tinyForm || {}).disabled),
buttonDisabled: computed(
() => props.disabled || state.disabled || (parent.buttonGroup || {}).disabled || state.formDisabled
diff --git a/packages/renderless/types/button.type.ts b/packages/renderless/types/button.type.ts
index 2dab128497..cf38c2eb95 100644
--- a/packages/renderless/types/button.type.ts
+++ b/packages/renderless/types/button.type.ts
@@ -7,6 +7,7 @@ export interface IButtonState {
timer: number
disabled: boolean
plain: ComputedRef
+ round: ComputedRef
formDisabled: ComputedRef
buttonDisabled: ComputedRef
}
diff --git a/packages/vue/src/button/src/index.ts b/packages/vue/src/button/src/index.ts
index b3b6d7e068..315ae70158 100644
--- a/packages/vue/src/button/src/index.ts
+++ b/packages/vue/src/button/src/index.ts
@@ -55,7 +55,10 @@ export const buttonProps = {
}
},
/** 是否圆角按钮 */
- round: Boolean,
+ round: {
+ type: Boolean,
+ default: undefined
+ },
/** 是否朴素按钮 */
plain: Boolean,
/** 是否圆形按钮 */
diff --git a/packages/vue/src/button/src/mobile-first.vue b/packages/vue/src/button/src/mobile-first.vue
index 23abdbd4a4..8cc4973afc 100644
--- a/packages/vue/src/button/src/mobile-first.vue
+++ b/packages/vue/src/button/src/mobile-first.vue
@@ -15,7 +15,7 @@
state.buttonDisabled ? '-disabled' : ''
}`
),
- gcls(round ? 'is-round' : 'no-round'),
+ gcls(state.round ? 'is-round' : 'no-round'),
gcls(circle ? 'is-circle' : 'no-circle'),
gcls({ 'is-border': circle || !(type === 'text' || icon) }),
gcls({ 'button-link': href }),
diff --git a/packages/vue/src/button/src/pc.vue b/packages/vue/src/button/src/pc.vue
index dc614cced9..70f780ecd9 100644
--- a/packages/vue/src/button/src/pc.vue
+++ b/packages/vue/src/button/src/pc.vue
@@ -24,7 +24,7 @@
'is-loading': loading,
'is-plain': state.plain,
'is-ghost': ghost,
- 'is-round': round,
+ 'is-round': state.round,
'is-circle': circle,
'is-icon': icon && !loading && (text || slots.default),
'is-only-icon': icon && !loading && !(text || slots.default)
From 083bece6b25941f49db6989a128c41f737e200e1 Mon Sep 17 00:00:00 2001
From: ajaxzheng <894103554@qq.com>
Date: Sat, 30 Nov 2024 17:01:09 +0800
Subject: [PATCH 3/3] fix: fix e2e test error
---
.../sites/demos/pc/app/config-provider/base-composition-api.vue | 2 +-
examples/sites/demos/pc/app/config-provider/base.vue | 2 +-
2 files changed, 2 insertions(+), 2 deletions(-)
diff --git a/examples/sites/demos/pc/app/config-provider/base-composition-api.vue b/examples/sites/demos/pc/app/config-provider/base-composition-api.vue
index a5f60ac82b..7280161653 100644
--- a/examples/sites/demos/pc/app/config-provider/base-composition-api.vue
+++ b/examples/sites/demos/pc/app/config-provider/base-composition-api.vue
@@ -75,7 +75,7 @@ const design = {
}
const handleSubmitPromise = () => {
- ruleFormRef.value.validate()
+ ruleFormRef.value.validate().catch(() => {})
}
const formData = ref({
diff --git a/examples/sites/demos/pc/app/config-provider/base.vue b/examples/sites/demos/pc/app/config-provider/base.vue
index d3a7a8ec92..24ac0e8342 100644
--- a/examples/sites/demos/pc/app/config-provider/base.vue
+++ b/examples/sites/demos/pc/app/config-provider/base.vue
@@ -91,7 +91,7 @@ export default {
},
methods: {
handleSubmitPromise() {
- this.$refs.ruleFormRef.validate()
+ this.$refs.ruleFormRef.validate().catch(() => {})
}
}
}