forked from opentiny/tiny-vue
(docs): update drag-outside-window of dialog-box (#1376)
* fix: add drag-outside-window of dialog-box * fix: update review * fix: update dialog-box apis * fix: update code review * fix: update code review * fix: update code review
This commit is contained in:
parent
e155c44b29
commit
a3b49e1474
|
@ -61,6 +61,14 @@ export default {
|
||||||
mode: ['pc'],
|
mode: ['pc'],
|
||||||
pcDemo: 'destroy-on-close'
|
pcDemo: 'destroy-on-close'
|
||||||
},
|
},
|
||||||
|
{
|
||||||
|
name: 'drag-outside-window',
|
||||||
|
type: 'boolean',
|
||||||
|
defaultValue: 'false',
|
||||||
|
desc: { 'zh-CN': '可将弹窗拖出窗口', 'en-US': 'Pop ups can be dragged out of the window' },
|
||||||
|
mode: ['pc'],
|
||||||
|
pcDemo: 'draggable'
|
||||||
|
},
|
||||||
{
|
{
|
||||||
name: 'dialog-class',
|
name: 'dialog-class',
|
||||||
type: 'string',
|
type: 'string',
|
||||||
|
|
|
@ -1,11 +1,13 @@
|
||||||
<template>
|
<template>
|
||||||
<div>
|
<div>
|
||||||
<tiny-button @click="boxVisibility = true"> 可拖拽弹窗 </tiny-button>
|
<tiny-button @click="dragDialog"> 可拖拽弹窗 </tiny-button>
|
||||||
<tiny-button @click="boxVisibility = true"> 可编辑拖拽弹窗 </tiny-button>
|
<tiny-button @click="dragDialogOutSide"> 可拖拽出窗口弹窗 </tiny-button>
|
||||||
<tiny-dialog-box
|
<tiny-dialog-box
|
||||||
|
v-if="boxVisibility"
|
||||||
draggable
|
draggable
|
||||||
v-model:visible="boxVisibility"
|
v-model:visible="boxVisibility"
|
||||||
title="鼠标移入标题区域单击拖拽"
|
title="鼠标移入标题区域单击拖拽"
|
||||||
|
:drag-outside-window="isDragOutSideFlag"
|
||||||
width="30%"
|
width="30%"
|
||||||
@drag-start="dragStart"
|
@drag-start="dragStart"
|
||||||
@drag-end="dragEnd"
|
@drag-end="dragEnd"
|
||||||
|
@ -31,6 +33,7 @@ import { ref } from 'vue'
|
||||||
import { Button as TinyButton, DialogBox as TinyDialogBox, Notify, Input as TinyInput, Modal } from '@opentiny/vue'
|
import { Button as TinyButton, DialogBox as TinyDialogBox, Notify, Input as TinyInput, Modal } from '@opentiny/vue'
|
||||||
|
|
||||||
const boxVisibility = ref(false)
|
const boxVisibility = ref(false)
|
||||||
|
const isDragOutSideFlag = ref(false)
|
||||||
const isNotifyMoving = ref(false)
|
const isNotifyMoving = ref(false)
|
||||||
const input = ref('鼠标移入标题区域单击拖拽')
|
const input = ref('鼠标移入标题区域单击拖拽')
|
||||||
|
|
||||||
|
@ -60,4 +63,13 @@ function dragMove() {
|
||||||
function beforeClose() {
|
function beforeClose() {
|
||||||
Modal.message({ message: 'before-close', status: 'info' })
|
Modal.message({ message: 'before-close', status: 'info' })
|
||||||
}
|
}
|
||||||
|
function dragDialog() {
|
||||||
|
boxVisibility.value = true
|
||||||
|
isDragOutSideFlag.value = false
|
||||||
|
}
|
||||||
|
|
||||||
|
function dragDialogOutSide() {
|
||||||
|
boxVisibility.value = true
|
||||||
|
isDragOutSideFlag.value = true
|
||||||
|
}
|
||||||
</script>
|
</script>
|
||||||
|
|
|
@ -1,11 +1,14 @@
|
||||||
<template>
|
<template>
|
||||||
<div>
|
<div>
|
||||||
<tiny-button @click="boxVisibility = true"> 可拖拽弹窗 </tiny-button>
|
<tiny-button @click="dragDialog"> 可拖拽弹窗 </tiny-button>
|
||||||
|
<tiny-button @click="dragDialogOutSide"> 可拖拽出窗口弹窗 </tiny-button>
|
||||||
<tiny-dialog-box
|
<tiny-dialog-box
|
||||||
|
v-if="boxVisibility"
|
||||||
draggable
|
draggable
|
||||||
v-model:visible="boxVisibility"
|
v-model:visible="boxVisibility"
|
||||||
title="鼠标移入标题区域单击拖拽"
|
title="鼠标移入标题区域单击拖拽"
|
||||||
width="30%"
|
width="30%"
|
||||||
|
:drag-outside-window="isDragOutSideFlag"
|
||||||
@drag-start="dragStart"
|
@drag-start="dragStart"
|
||||||
@drag-end="dragEnd"
|
@drag-end="dragEnd"
|
||||||
@drag-move="dragMove"
|
@drag-move="dragMove"
|
||||||
|
@ -38,7 +41,8 @@ export default {
|
||||||
return {
|
return {
|
||||||
input: '鼠标移入标题区域单击拖拽',
|
input: '鼠标移入标题区域单击拖拽',
|
||||||
boxVisibility: false,
|
boxVisibility: false,
|
||||||
isNotifyMoving: false
|
isNotifyMoving: false,
|
||||||
|
isDragOutSideFlag: false
|
||||||
}
|
}
|
||||||
},
|
},
|
||||||
methods: {
|
methods: {
|
||||||
|
@ -65,6 +69,14 @@ export default {
|
||||||
},
|
},
|
||||||
beforeClose() {
|
beforeClose() {
|
||||||
Modal.message({ message: 'before-close', status: 'info' })
|
Modal.message({ message: 'before-close', status: 'info' })
|
||||||
|
},
|
||||||
|
dragDialog() {
|
||||||
|
this.boxVisibility = true
|
||||||
|
this.isDragOutSideFlag = false
|
||||||
|
},
|
||||||
|
dragDialogOutSide() {
|
||||||
|
this.boxVisibility = true
|
||||||
|
this.isDragOutSideFlag = true
|
||||||
}
|
}
|
||||||
}
|
}
|
||||||
}
|
}
|
||||||
|
|
|
@ -207,9 +207,9 @@ export default {
|
||||||
},
|
},
|
||||||
desc: {
|
desc: {
|
||||||
'zh-CN':
|
'zh-CN':
|
||||||
'<p>可通过<code>draggable</code>属性设置<code>true</code>,鼠标点击标题区域拖拽;通过<code>:dragOutsideWindow</code>属性设置<code>true</code>,将弹窗拖出窗口。具体事件:<code>@drag-start</code><code>@drag-move</code><code>@drag-end</code>。</p>\n',
|
'<p>可通过<code>draggable</code>属性设置<code>true</code>,鼠标点击标题区域拖拽;通过<code>drag-outside-window</code>属性设置<code>true</code>,将弹窗拖出窗口。具体事件:<code>@drag-start</code><code>@drag-move</code><code>@drag-end</code>。</p>\n',
|
||||||
'en-US':
|
'en-US':
|
||||||
'<p>By setting the<code>draggable</code>attribute to<code>true</code>, click and drag in the title area with the mouse; setting the code <code>dragOutsideWindow</code>attribute to<code>true</code>, drag the dialog box outside the window.Specific events:<code>@drag-start</code><code>@drag-move</code><code>@drag-end</code>.</p>\n'
|
'<p>By setting the<code>draggable</code>attribute to<code>true</code>, click and drag in the title area with the mouse; setting the code <code>drag-outside-window</code>attribute to<code>true</code>, drag the dialog box outside the window.Specific events:<code>@drag-start</code><code>@drag-move</code><code>@drag-end</code>.</p>\n'
|
||||||
},
|
},
|
||||||
codeFiles: ['draggable.vue']
|
codeFiles: ['draggable.vue']
|
||||||
},
|
},
|
||||||
|
|
Loading…
Reference in New Issue