一、首先创建一个双开门的蒙层组件
<!-- DoorOverlay.vue -->
<template>
<div v-if="isVisible" class="door-overlay">
<div class="door left-door"></div>
<div class="door right-door"></div>
</div>
</template>
<script>
export default {
data() {
return {
isVisible: false
};
},
methods: {
show() {
this.isVisible = true;
},
hide() {
this.isVisible = false;
}
}
};
</script>
<style scoped>
.door-overlay {
position: fixed;
top: 0;
left: 0;
width: 100%;
height: 100%;
display: flex;
justify-content: space-between;
align-items: center;
/* background-color: rgba(0, 0, 0, 0.5); */
z-index: 9999;
overflow: hidden;
}
.door {
width: 50%;
height: 100%;
background-color: #4891DA;
transition: transform 0.5s;
}
.left-door {