From efe2045b48d6f3bfd305e0af355942737fa38f1d Mon Sep 17 00:00:00 2001 From: gausszhou Date: Thu, 18 Dec 2025 23:37:55 +0800 Subject: [PATCH] feat(modal): supports setting the headerDragable property --- examples/sites/demos/apis/modal.js | 16 +++++++++++++++- .../sites/demos/pc/app/modal/modal-header.vue | 18 ++++++++++++++++-- .../sites/demos/pc/app/modal/webdoc/modal.js | 13 +++++++------ packages/vue/src/modal/src/index.ts | 1 + packages/vue/src/modal/src/pc.vue | 3 ++- 5 files changed, 41 insertions(+), 10 deletions(-) diff --git a/examples/sites/demos/apis/modal.js b/examples/sites/demos/apis/modal.js index 22b4567d48..322c38c687 100644 --- a/examples/sites/demos/apis/modal.js +++ b/examples/sites/demos/apis/modal.js @@ -115,7 +115,7 @@ export default { { name: 'footer-dragable', type: 'boolean', - defaultValue: 'true', + defaultValue: 'false', desc: { 'zh-CN': '控制底部可拖拽', 'en-US': 'Control bottom dragable' @@ -123,6 +123,20 @@ export default { mode: ['pc'], pcDemo: 'modal-footer' }, + { + name: 'header-dragable', + type: 'boolean', + defaultValue: 'true', + desc: { + 'zh-CN': '控制标题可拖拽', + 'en-US': 'Control header dragable' + }, + mode: ['pc'], + pcDemo: 'modal-header', + meta: { + stable: '3.28.0' + } + }, { name: 'fullscreen', type: 'boolean', diff --git a/examples/sites/demos/pc/app/modal/modal-header.vue b/examples/sites/demos/pc/app/modal/modal-header.vue index 0820c67393..bef3779f36 100644 --- a/examples/sites/demos/pc/app/modal/modal-header.vue +++ b/examples/sites/demos/pc/app/modal/modal-header.vue @@ -7,7 +7,15 @@

标签式调用

自定义弹窗标题 - + +
@@ -27,7 +35,13 @@ export default { }, methods: { btnClick() { - Modal.alert({ message: '窗口内容', title: '自定义弹窗标题', showHeader: true, showFooter: true }) + Modal.alert({ + message: '窗口内容', + title: '自定义弹窗标题', + showHeader: true, + showFooter: true, + headerDragable: false + }) }, openModal() { this.show = true diff --git a/examples/sites/demos/pc/app/modal/webdoc/modal.js b/examples/sites/demos/pc/app/modal/webdoc/modal.js index c0e32d961c..26c540b371 100644 --- a/examples/sites/demos/pc/app/modal/webdoc/modal.js +++ b/examples/sites/demos/pc/app/modal/webdoc/modal.js @@ -77,7 +77,8 @@ export default { }, desc: { 'zh-CN': ` - 通过 show-header属性,设置是否显示头部。默认值为:true
+ 通过show-header属性,设置是否显示头部。默认值为:true
+ 通过header-dragable属性,设置是否可以通过标题拖动弹窗。默认值为:true
通过title属性,设置窗口的标题。
`, 'en-US': ` @@ -95,17 +96,17 @@ export default { }, desc: { 'zh-CN': ` - 通过show-footer属性设置是否显示底部。默认值为:false
- 通过confirm-content属性,修改确认按钮文字;cancel-content属性,修改取消按钮文字。
- 通过confirm-btn-props属性,修改确认按钮的属性;cancel-btn-props属性,修改取消按钮的属性。
- 通过footerDragable属性,让底部也支持拖动(默认只有标题栏可拖动)。默认值为:false
+ 通过show-footer属性,设置是否显示底部。默认值为:false
+ 通过footer-dragable属性,让底部也支持拖动(默认只有标题栏可拖动)。默认值为:false
+ 通过confirm-content属性,修改确认按钮文字;通过cancel-content属性,修改取消按钮文字。
+ 通过confirm-btn-props属性,修改确认按钮的属性;通过cancel-btn-props属性,修改取消按钮的属性。
通过#footer插槽,完全自定义底部内容。
`, 'en-US': ` Use the show-footer property to set whether the bottom is displayed. The default value is false
Modify the confirmation button text by using the confirm-content property; The cancer-content property modifies the cancel button text.
The confirm-btn-props property is used to modify the properties of the confirm button. cancer-btn-props property to modify the properties of the cancel button.
- Use the footerDragable property to make the bottom also dragable (by default, only the title bar can be dragged). The default value is false
+ Use the footer-dragable property to make the bottom also dragable (by default, only the title bar can be dragged). The default value is false
Completely customize the bottom content via the #footer slot.
` }, diff --git a/packages/vue/src/modal/src/index.ts b/packages/vue/src/modal/src/index.ts index 31bc96310f..0b3361484e 100644 --- a/packages/vue/src/modal/src/index.ts +++ b/packages/vue/src/modal/src/index.ts @@ -96,6 +96,7 @@ export const modalProps = { customClass: String, // mf 属性 confirmBtnProps: { type: Object, default: () => ({}) }, cancelBtnProps: { type: Object, default: () => ({}) }, + headerDragable: { type: Boolean, default: true }, footerDragable: Boolean, tiny_theme: String, slots: Object diff --git a/packages/vue/src/modal/src/pc.vue b/packages/vue/src/modal/src/pc.vue index 4b32f2463f..7021ee538c 100644 --- a/packages/vue/src/modal/src/pc.vue +++ b/packages/vue/src/modal/src/pc.vue @@ -66,6 +66,7 @@ export default defineComponent({ 'cancelContent', 'confirmBtnProps', 'cancelBtnProps', + 'headerDragable', 'footerDragable', 'tiny_theme', 'slots', @@ -174,7 +175,7 @@ export default defineComponent({ { class: ['tiny-modal__header', status && state.theme === 'saas' ? 'tiny-modal__header-icon' : ''], on: { - mousedown: this.mousedownEvent + mousedown: this.headerDragable ? this.mousedownEvent : () => {} } }, [