fix(dialog-box): 修复对话框移动后动态style没更新的bug (#195)

This commit is contained in:
黄怡林 2023-05-06 10:51:13 +08:00 committed by GitHub
parent 4d448833e0
commit b89b033721
No known key found for this signature in database
GPG Key ID: 4AEE18F83AFDEB23
2 changed files with 14 additions and 6 deletions

View File

@ -19,7 +19,7 @@
</template>
<script lang="jsx">
import { Button, DialogBox } from '@opentiny/vue'
import { Button, DialogBox, Notify } from '@opentiny/vue'
export default {
components: {
@ -33,13 +33,19 @@ export default {
},
methods: {
dragStart() {
window.tinyLog('拖拽开始')
Notify({
message: '拖拽开始',
position: 'top-right'
})
},
dragEnd() {
window.tinyLog('拖拽结束')
Notify({
message: '拖拽结束',
position: 'top-right'
})
},
dragMove() {
window.tinyLog('拖拽移动')
//
}
}
}

View File

@ -31,13 +31,13 @@ export const computedStyle = ({ props, state }) => () => {
if (!state.isFull) {
style.width = width
style.top = top
style.top = state.top || top
if (rightSlide) {
style.right = 0
style.height = 'calc(100vh - ' + style.top + ')'
} else {
style.left = 'calc((100vw - ' + width + ') / 2)'
style.left = state.left || 'calc((100vw - ' + width + ') / 2)'
}
}
@ -239,6 +239,8 @@ export const handleDrag = ({ parent, props, state, emit }) => (event) => {
modalBoxElem.style.left = `${left}px`
modalBoxElem.style.top = `${top}px`
state.left = `${left}px`
state.top = `${top}px`
state.emitter.emit('boxdrag')
emit('drag-move', event)