Skip to content

Commit bf129e1

Browse files
authored
feat(modal): supports setting the headerDragable property (#3918)
1 parent 9c5d345 commit bf129e1

File tree

5 files changed

+41
-10
lines changed

5 files changed

+41
-10
lines changed

examples/sites/demos/apis/modal.js

Lines changed: 15 additions & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -115,14 +115,28 @@ export default {
115115
{
116116
name: 'footer-dragable',
117117
type: 'boolean',
118-
defaultValue: 'true',
118+
defaultValue: 'false',
119119
desc: {
120120
'zh-CN': '控制底部可拖拽',
121121
'en-US': 'Control bottom dragable'
122122
},
123123
mode: ['pc'],
124124
pcDemo: 'modal-footer'
125125
},
126+
{
127+
name: 'header-dragable',
128+
type: 'boolean',
129+
defaultValue: 'true',
130+
desc: {
131+
'zh-CN': '控制标题可拖拽',
132+
'en-US': 'Control header dragable'
133+
},
134+
mode: ['pc'],
135+
pcDemo: 'modal-header',
136+
meta: {
137+
stable: '3.28.0'
138+
}
139+
},
126140
{
127141
name: 'fullscreen',
128142
type: 'boolean',

examples/sites/demos/pc/app/modal/modal-header.vue

Lines changed: 16 additions & 2 deletions
Original file line numberDiff line numberDiff line change
@@ -7,7 +7,15 @@
77
<h2>标签式调用</h2>
88
<div class="content">
99
<tiny-button @click="openModal">自定义弹窗标题</tiny-button>
10-
<tiny-modal v-model="show" title="自定义弹窗标题" message="窗口内容" show-header show-footer> </tiny-modal>
10+
<tiny-modal
11+
v-model="show"
12+
title="自定义弹窗标题"
13+
message="窗口内容"
14+
show-header
15+
show-footer
16+
:header-dragable="false"
17+
>
18+
</tiny-modal>
1119
</div>
1220
</div>
1321
</template>
@@ -27,7 +35,13 @@ export default {
2735
},
2836
methods: {
2937
btnClick() {
30-
Modal.alert({ message: '窗口内容', title: '自定义弹窗标题', showHeader: true, showFooter: true })
38+
Modal.alert({
39+
message: '窗口内容',
40+
title: '自定义弹窗标题',
41+
showHeader: true,
42+
showFooter: true,
43+
headerDragable: false
44+
})
3145
},
3246
openModal() {
3347
this.show = true

examples/sites/demos/pc/app/modal/webdoc/modal.js

Lines changed: 7 additions & 6 deletions
Original file line numberDiff line numberDiff line change
@@ -77,7 +77,8 @@ export default {
7777
},
7878
desc: {
7979
'zh-CN': `
80-
通过 <code>show-header</code>属性,设置是否显示头部。默认值为:<code>true</code><br>
80+
通过<code>show-header</code>属性,设置是否显示头部。默认值为:<code>true</code>。<br>
81+
通过<code>header-dragable</code>属性,设置是否可以通过标题拖动弹窗。默认值为:<code>true</code>。<br>
8182
通过<code>title</code>属性,设置窗口的标题。<br>
8283
`,
8384
'en-US': `
@@ -95,17 +96,17 @@ export default {
9596
},
9697
desc: {
9798
'zh-CN': `
98-
通过<code>show-footer</code>属性设置是否显示底部。默认值为:<code>false</code> <br>
99-
通过<code>confirm-content</code>属性,修改确认按钮文字;<code>cancel-content</code>属性,修改取消按钮文字。<br>
100-
通过<code>confirm-btn-props</code>属性,修改确认按钮的属性;<code>cancel-btn-props</code>属性,修改取消按钮的属性。<br>
101-
通过<code>footerDragable</code>属性,让底部也支持拖动(默认只有标题栏可拖动)。默认值为:<code>false</code><br>
99+
通过<code>show-footer</code>属性,设置是否显示底部。默认值为:<code>false</code><br>
100+
通过<code>footer-dragable</code>属性,让底部也支持拖动(默认只有标题栏可拖动)。默认值为:<code>false</code>。<br>
101+
通过<code>confirm-content</code>属性,修改确认按钮文字;通过<code>cancel-content</code>属性,修改取消按钮文字。<br>
102+
通过<code>confirm-btn-props</code>属性,修改确认按钮的属性;通过<code>cancel-btn-props</code>属性,修改取消按钮的属性。<br>
102103
通过<code>#footer</code>插槽,完全自定义底部内容。<br>
103104
`,
104105
'en-US': `
105106
Use the <code>show-footer</code> property to set whether the bottom is displayed. The default value is <code>false</code> <br>
106107
Modify the confirmation button text by using the <code>confirm-content</code> property; The <code> cancer-content </code> property modifies the cancel button text. <br>
107108
The <code>confirm-btn-props</code> property is used to modify the properties of the confirm button. <code> cancer-btn-props </code> property to modify the properties of the cancel button. <br>
108-
Use the <code>footerDragable</code> property to make the bottom also dragable (by default, only the title bar can be dragged). The default value is <code>false</code><br>
109+
Use the <code>footer-dragable</code> property to make the bottom also dragable (by default, only the title bar can be dragged). The default value is <code>false</code><br>
109110
Completely customize the bottom content via the <code>#footer</code> slot. <br>
110111
`
111112
},

packages/vue/src/modal/src/index.ts

Lines changed: 1 addition & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -96,6 +96,7 @@ export const modalProps = {
9696
customClass: String, // mf 属性
9797
confirmBtnProps: { type: Object, default: () => ({}) },
9898
cancelBtnProps: { type: Object, default: () => ({}) },
99+
headerDragable: { type: Boolean, default: true },
99100
footerDragable: Boolean,
100101
tiny_theme: String,
101102
slots: Object

packages/vue/src/modal/src/pc.vue

Lines changed: 2 additions & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -66,6 +66,7 @@ export default defineComponent({
6666
'cancelContent',
6767
'confirmBtnProps',
6868
'cancelBtnProps',
69+
'headerDragable',
6970
'footerDragable',
7071
'tiny_theme',
7172
'slots',
@@ -174,7 +175,7 @@ export default defineComponent({
174175
{
175176
class: ['tiny-modal__header', status && state.theme === 'saas' ? 'tiny-modal__header-icon' : ''],
176177
on: {
177-
mousedown: this.mousedownEvent
178+
mousedown: this.headerDragable ? this.mousedownEvent : () => {}
178179
}
179180
},
180181
[

0 commit comments

Comments
 (0)