Commit 03df51db authored by 毛线's avatar 毛线

弹窗兼容

parent 40db9b73
...@@ -88,3 +88,5 @@ sw.* ...@@ -88,3 +88,5 @@ sw.*
# Vim swap files # Vim swap files
*.swp *.swp
/pages/test/*
...@@ -174,7 +174,7 @@ export default { ...@@ -174,7 +174,7 @@ export default {
.header { .header {
height: 80px; height: 80px;
position: relative; position: relative;
z-index: 1; z-index: 100;
} }
.left-block { .left-block {
position: absolute; position: absolute;
......
<template> <template>
<Dialog <Dialog
:visible.sync="visible" ref="dialog"
:show-close="false"
:append-to-body="true"
:style="style"
top="0px"
custom-class="game-dialog"
title=""
width="542px" width="542px"
modal-append-to-body
> >
<div class="bg"/> <div class="bg"/>
<div class="content"> <div class="content">
...@@ -26,9 +19,7 @@ ...@@ -26,9 +19,7 @@
</template> </template>
<script> <script>
import { import Dialog from '@/components/dialog/index'
Dialog,
} from 'element-ui'
import { mapState } from 'vuex' import { mapState } from 'vuex'
export default { export default {
components: { components: {
...@@ -57,18 +48,14 @@ export default { ...@@ -57,18 +48,14 @@ export default {
...mapState([ ...mapState([
'zoom', 'zoom',
]), ]),
style() { },
const { zoom } = this watch: {
const style = { visible(value) {
zoom, if (value) {
} this.$refs.dialog.show()
const { innerWidth, innerHeight } = window
if (innerWidth / innerHeight > 1080 / 608) {
style.top = `120px`
} else { } else {
style.top = `${(innerHeight / 2 - (184 * zoom)) / zoom}px` this.$refs.dialog.close()
} }
return style
}, },
}, },
methods: { methods: {
...@@ -77,7 +64,6 @@ export default { ...@@ -77,7 +64,6 @@ export default {
this.visible = false this.visible = false
}, },
show() { show() {
console.log('show')
this.visible = true this.visible = true
}, },
}, },
......
<template>
<div v-show="visible" class="dialog-layout" >
<div class="mark"/>
<div class="dlalog">
<slot/>
</div>
</div>
</template>
<script>
export default {
components: {
},
data() {
return {
visible: false,
}
},
methods: {
show() {
this.visible = true
},
close() {
this.visible = false
},
},
}
</script>
<style lang="scss" scoped>
.dialog-layout {
position: fixed;
top: 0;
bottom: 0;
left: 0;
right: 0;
display: flex;
justify-content: center;
align-items: center;
z-index: 9999;
.mark {
position: absolute;
top: 0;
bottom: 0;
left: 0;
right: 0;
background: black;
opacity: 0.3;
}
.dlalog {
width: 620px;
height: 350px;
position: relative;
}
}
</style>
Markdown is supported
0% or
You are about to add 0 people to the discussion. Proceed with caution.
Finish editing this message first!
Please register or to comment