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 @@ 主要按钮 成功按钮 信息按钮 - 警告按钮 + 警告按钮 警告按钮警告按钮警告按钮 危险按钮 文本按钮 diff --git a/examples/sites/demos/mobile-first/app/button/webdoc/button.js b/examples/sites/demos/mobile-first/app/button/webdoc/button.js index 706e9ea459..636b81f52a 100644 --- a/examples/sites/demos/mobile-first/app/button/webdoc/button.js +++ b/examples/sites/demos/mobile-first/app/button/webdoc/button.js @@ -72,9 +72,9 @@ export default { }, desc: { 'zh-CN': - '

通过 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.

' }, codeFiles: ['type.vue'] }, diff --git a/examples/sites/demos/pc/app/button/icon-composition-api.vue b/examples/sites/demos/pc/app/button/icon-composition-api.vue index e47f752877..f7ea0bb133 100644 --- a/examples/sites/demos/pc/app/button/icon-composition-api.vue +++ b/examples/sites/demos/pc/app/button/icon-composition-api.vue @@ -3,7 +3,9 @@ 图标按钮 - 图标按钮 + + 图标按钮图标按钮图标按钮图标按钮 + 图标按钮 图标按钮 图标按钮 diff --git a/examples/sites/demos/pc/app/button/icon.vue b/examples/sites/demos/pc/app/button/icon.vue index 79bc59ef10..4938c253cb 100644 --- a/examples/sites/demos/pc/app/button/icon.vue +++ b/examples/sites/demos/pc/app/button/icon.vue @@ -3,7 +3,9 @@ 图标按钮 - 图标按钮 + + 图标按钮图标按钮图标按钮图标按钮 + 图标按钮 图标按钮 图标按钮 diff --git a/examples/sites/demos/pc/app/button/webdoc/button.js b/examples/sites/demos/pc/app/button/webdoc/button.js index 716c798383..fa3da95f09 100644 --- a/examples/sites/demos/pc/app/button/webdoc/button.js +++ b/examples/sites/demos/pc/app/button/webdoc/button.js @@ -47,8 +47,9 @@ export default { 'en-US': 'Icon Button' }, desc: { - 'zh-CN': '通过 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) {