|
|
@ -1,22 +1,38 @@ |
|
|
|
<template> |
|
|
|
<Teleport> |
|
|
|
<Transition name="fade"> |
|
|
|
<div :class="['mask-layer', { 'none-mask': noneMask }]" v-if="modelVisible"> |
|
|
|
<BackgroundClip class='dialog' |
|
|
|
<div |
|
|
|
:class="['mask-layer', { 'none-mask': noneMask }]" |
|
|
|
v-if="modelVisible" |
|
|
|
> |
|
|
|
<BackgroundClip |
|
|
|
class="dialog" |
|
|
|
clipPath="polygon(calc(100% - var(--clip-width)) 0, 100% var(--clip-width), 100% 100%, var(--clip-width) 100%, 0 calc(100% - var(--clip-width)), 0 0)" |
|
|
|
borderColor="linear-gradient(180deg, rgba(78, 174, 204, .9), rgba(78, 174, 204, 0))" |
|
|
|
bgColor="linear-gradient(180deg, rgba(14, 69, 92, 0.9) 0%, rgba(20, 89, 119, 0.9) 100%)" ref="DialogContentRef"> |
|
|
|
bgColor="linear-gradient(180deg, rgba(14, 69, 92, 0.9) 0%, rgba(20, 89, 119, 0.9) 100%)" |
|
|
|
ref="DialogContentRef" |
|
|
|
> |
|
|
|
<div class="dialog-title"> |
|
|
|
<img class="title-icon" src="@screen/images/dialog/title-icon.svg" /> |
|
|
|
<img |
|
|
|
class="title-icon" |
|
|
|
src="@screen/images/dialog/title-icon.svg" |
|
|
|
/> |
|
|
|
<span>{{ title }}</span> |
|
|
|
<img class="icon-close" @click.stop="modelVisible = false" src="@screen/images/dialog/icon-close.svg" /> |
|
|
|
<img |
|
|
|
class="icon-close" |
|
|
|
@click.stop="modelVisible = false" |
|
|
|
src="@screen/images/dialog/icon-close.svg" |
|
|
|
/> |
|
|
|
</div> |
|
|
|
|
|
|
|
<div class="dialog-content"> |
|
|
|
<slot /> |
|
|
|
</div> |
|
|
|
|
|
|
|
<img class="bottom-right" src="@screen/images/dialog/right-bottom.svg"> |
|
|
|
<img |
|
|
|
class="bottom-right" |
|
|
|
src="@screen/images/dialog/right-bottom.svg" |
|
|
|
/> |
|
|
|
|
|
|
|
<div class="footer" v-if="$slots.footer"> |
|
|
|
<slot name="footer"></slot> |
|
|
@ -28,71 +44,74 @@ |
|
|
|
</template> |
|
|
|
|
|
|
|
<script> |
|
|
|
import Teleport from '../Teleport.vue'; |
|
|
|
import Teleport from "../Teleport.vue"; |
|
|
|
import BackgroundClip from "@screen/components/Decorations/BackgroundClip.vue"; |
|
|
|
import { moveable, stopPropagation } from "./utils" |
|
|
|
import { moveable, stopPropagation } from "./utils"; |
|
|
|
|
|
|
|
export default { |
|
|
|
components: { |
|
|
|
Teleport, |
|
|
|
BackgroundClip |
|
|
|
BackgroundClip, |
|
|
|
}, |
|
|
|
model: { |
|
|
|
prop: 'visible', |
|
|
|
event: "update:value" |
|
|
|
prop: "visible", |
|
|
|
event: "update:value", |
|
|
|
}, |
|
|
|
name: 'Dialog', |
|
|
|
name: "Dialog", |
|
|
|
props: { |
|
|
|
title: { |
|
|
|
type: String |
|
|
|
type: String, |
|
|
|
}, |
|
|
|
visible: Boolean, |
|
|
|
noneMask: { |
|
|
|
type: Boolean, |
|
|
|
default: false |
|
|
|
} |
|
|
|
default: false, |
|
|
|
}, |
|
|
|
}, |
|
|
|
watch: { |
|
|
|
visible: { |
|
|
|
deep: true, |
|
|
|
handler(bool) { |
|
|
|
this.$nextTick(() => { |
|
|
|
if (!bool) return this.destroyMoveable?.() |
|
|
|
if (!bool) return this.destroyMoveable?.(); |
|
|
|
|
|
|
|
const container = this.$refs.DialogContentRef.$el; |
|
|
|
|
|
|
|
this.destroyMoveable = moveable(container, { target: container.querySelector(".dialog-title") }); |
|
|
|
this.destroyMoveable = moveable(container, { |
|
|
|
target: container.querySelector(".dialog-title"), |
|
|
|
}); |
|
|
|
|
|
|
|
stopPropagation(container.querySelector(".dialog-title").lastChild) |
|
|
|
stopPropagation(container.querySelector(".dialog-title").lastChild); |
|
|
|
|
|
|
|
this.$once("hook:beforeDestroy", () => this.destroyMoveable?.()); |
|
|
|
}) |
|
|
|
} |
|
|
|
} |
|
|
|
}); |
|
|
|
}, |
|
|
|
}, |
|
|
|
}, |
|
|
|
computed: { |
|
|
|
modelVisible: { |
|
|
|
get() { |
|
|
|
return this.visible |
|
|
|
return this.visible; |
|
|
|
}, |
|
|
|
set(val) { |
|
|
|
this.$emit('update:value', val) |
|
|
|
} |
|
|
|
} |
|
|
|
console.log("val", val); |
|
|
|
this.$emit("update:value", val); |
|
|
|
}, |
|
|
|
}, |
|
|
|
}, |
|
|
|
beforeDestroy() { |
|
|
|
this.modelVisible = false; |
|
|
|
}, |
|
|
|
} |
|
|
|
}; |
|
|
|
</script> |
|
|
|
|
|
|
|
<style lang='scss' scoped> |
|
|
|
<style lang="scss" scoped> |
|
|
|
.mask-layer { |
|
|
|
position: fixed; |
|
|
|
top: 0; |
|
|
|
width: 100%; |
|
|
|
height: 100%; |
|
|
|
background: rgba(0, 0, 0, .36); |
|
|
|
background: rgba(0, 0, 0, 0.36); |
|
|
|
border-radius: 0px 0px 0px 0px; |
|
|
|
z-index: 100; |
|
|
|
display: flex; |
|
|
@ -111,7 +130,7 @@ export default { |
|
|
|
|
|
|
|
.fade-enter-active, |
|
|
|
.fade-leave-active { |
|
|
|
transition: opacity .24s; |
|
|
|
transition: opacity 0.24s; |
|
|
|
} |
|
|
|
|
|
|
|
.fade-enter, |
|
|
|