diff --git a/examples/sites/demos/apis/button.js b/examples/sites/demos/apis/button.js
index 01acea838c..b5fcc6aac8 100644
--- a/examples/sites/demos/apis/button.js
+++ b/examples/sites/demos/apis/button.js
@@ -63,6 +63,21 @@ export default {
pcDemo: 'dynamic-disabled',
mfDemo: ''
},
+ {
+ name: 'custom-style',
+ type: 'object',
+ defaultValue: '',
+ desc: {
+ 'zh-CN': '设置 custom-style 属性按钮样式',
+ 'en-US': 'Set the custom-style attribute to customize the button style'
+ },
+ meta: {
+ stable: '3.25.0'
+ },
+ mode: ['pc', 'mobile-first'],
+ pcDemo: 'icon',
+ mfDemo: 'type'
+ },
{
name: 'ghost',
type: 'boolean',
diff --git a/examples/sites/demos/mobile-first/app/button/type.vue b/examples/sites/demos/mobile-first/app/button/type.vue
index b4aa33c8e0..26e093d34b 100644
--- a/examples/sites/demos/mobile-first/app/button/type.vue
+++ b/examples/sites/demos/mobile-first/app/button/type.vue
@@ -4,7 +4,7 @@
通过 type
属性可以设置不同的主题样式,主要包括 primary、success、info、warning、danger、text。
', + '
通过 type
属性可以设置不同的主题样式,主要包括 primary、success、info、warning、danger、text。设置 custom-style
属性按钮样式
', 'en-US': - '
You can use the type
attribute to set different theme styles, including primary, success, info, warning, danger, and text.
You can use the type
attribute to set different theme styles, including primary, success, info, warning, danger, and text. The custom-style
property sets the button style.
icon
属性,设置按钮展示图标。',
- 'en-US': 'Display icons and receive an icon component through the icon
settings button'
+ 'zh-CN': '通过 icon
属性,设置按钮展示图标。custom-style
属性设置按钮样式。',
+ 'en-US':
+ 'Display icons and receive an icon component through the icon
settings button. The custom-style
property sets the button style.'
},
codeFiles: ['icon.vue']
},
diff --git a/packages/vue/src/button/src/index.ts b/packages/vue/src/button/src/index.ts
index e9be1c01e4..6e07588bde 100644
--- a/packages/vue/src/button/src/index.ts
+++ b/packages/vue/src/button/src/index.ts
@@ -79,6 +79,11 @@ export const buttonProps = {
type: Boolean,
default: false
},
+ /** 自定义样式 */
+ customStyle: {
+ type: Object,
+ default: () => ({})
+ },
/** 是否幽灵按钮 */
ghost: Boolean,
/** 点击事件 */
diff --git a/packages/vue/src/button/src/mobile-first.vue b/packages/vue/src/button/src/mobile-first.vue
index cc270905a4..d86da07a06 100644
--- a/packages/vue/src/button/src/mobile-first.vue
+++ b/packages/vue/src/button/src/mobile-first.vue
@@ -22,6 +22,7 @@
customClass
)
"
+ :style="customStyle"
:tabindex="tabindex"
v-bind="a($attrs, ['class', 'style', 'id'], true)"
>
@@ -62,7 +63,8 @@ export default defineComponent({
'tabindex',
'href',
'customClass',
- 'banner'
+ 'banner',
+ 'customStyle'
],
components: { IconLoading: iconLoading() },
setup(props, context): any {
diff --git a/packages/vue/src/button/src/pc.vue b/packages/vue/src/button/src/pc.vue
index 70f780ecd9..b3a7611c77 100644
--- a/packages/vue/src/button/src/pc.vue
+++ b/packages/vue/src/button/src/pc.vue
@@ -30,6 +30,7 @@
'is-only-icon': icon && !loading && !(text || slots.default)
}
]"
+ :style="customStyle"
:tabindex="tabindex"
v-bind="a($attrs, ['class', 'style', 'title', 'id'], true)"
>
@@ -66,7 +67,8 @@ export default defineComponent({
'circle',
'tabindex',
'customClass',
- 'ghost'
+ 'ghost',
+ 'customStyle'
],
components: { IconLoading: iconLoadingShadow() },
setup(props, context) {