gpt4 book ai didi

javascript - Vue js 模态不会调整到它包含的元素的宽度以下

转载 作者:行者123 更新时间:2023-11-28 02:44:24 26 4
gpt4 key购买 nike

我正在尝试使用 Vue js modal example在更大的尺寸。我将“modal-container”类设置为 500px 宽,30px 的填充和 80% 的最大宽度。出于某种原因,包含容器类的“modal-mask”类在设置为 100% 宽度时不会调整到低于 560px。这是怎么回事?

简单来说:我想要一个更大的模式,我希望它以最小宽度适合页面。

<template id="modal-template">
<transition name="modal">
<div class="modal-mask">
<div class="modal-wrapper">
<div class="modal-container">

<div class="modal-header">
<slot name="header">
default header
</slot>
</div>

<div class="modal-body">
<slot name="body">
default body
</slot>
</div>

<div class="modal-footer">
<slot name="footer">
default footer
<button class="modal-default-button" @click="hideModal">
OK
</button>
</slot>
</div>
</div>
</div>
</div>
</transition>
</template>

<script>
export default {
name: 'VueModal',
methods: {
hideModal () {
return this.$store.commit('hideModal')
}
}
}
</script>

<style>
.modal-mask {
position: fixed;
z-index: 9998;
top: 0;
left: 0;
width: 100%;
height: 100%;
background-color: rgba(0, 0, 0, .5);
display: table;
transition: opacity .3s ease;
}

.modal-wrapper {
display: table-cell;
vertical-align: middle;
}

.modal-container {
width: 500px;
max-width: 80%;
margin: 0px auto;
padding: 20px 30px;
background-color: #fff;
border-radius: 2px;
box-shadow: 0 2px 8px rgba(0, 0, 0, .33);
transition: all .3s ease;
font-family: Helvetica, Arial, sans-serif;
}

.modal-header h3 {
margin-top: 0;
color: #42b983;
}

.modal-body {
margin: 20px 0;
}

.modal-default-button {
float: right;
}

.modal-enter {
opacity: 0;
}

.modal-leave-active {
opacity: 0;
}

.modal-enter .modal-container,
.modal-leave-active .modal-container {
-webkit-transform: scale(1.1);
transform: scale(1.1);
}
</style>

最佳答案

modal-mask 类上的“table-layout: fixed”对我有用。

关于javascript - Vue js 模态不会调整到它包含的元素的宽度以下,我们在Stack Overflow上找到一个类似的问题: https://stackoverflow.com/questions/46994174/

26 4 0
Copyright 2021 - 2024 cfsdn All Rights Reserved 蜀ICP备2022000587号
广告合作:1813099741@qq.com 6ren.com