element-ui 遮罩层el-dialog 中间内容被被蒙板遮住 解决

版权声明:本文为博主原创文章,未经博主允许不得转载。 https://blog.csdn.net/adley_app/article/details/84254727

原因: Dialog 的外层布局的 position 值为 fixed, absolute, relative 三者之一时,就会出现被蒙板遮住的情况。

解决:

// 在 el-dialog 标签里添加 :append-to-body="true"

 <!-- 编辑弹出框 -->
    <el-dialog title="添加用户" :visible.sync="editVisible" width="30%" :append-to-body="true">
        <el-form ref="form" :model="form" label-width="80px">
            <el-form-item label="用户名">
                <el-input v-model="form.username"></el-input>
            </el-form-item>
            <el-form-item label="密 码">
                <el-input v-model="form.password"></el-input>
            </el-form-item>
        </el-form>
        <span slot="footer" class="dialog-footer" >
            <el-button @click="editVisible = false">取 消</el-button>
            <el-button type="primary" @click="saveEdit">确 定</el-button>
        </span>
    </el-dialog>

    <!-- 删除提示框 -->
    <el-dialog title="提示" :visible.sync="delVisible" width="300px" center :append-to-body="true">
        <div class="del-dialog-cnt">删除不可恢复,是否确定删除?</div>
        <span slot="footer" class="dialog-footer">
            <el-button @click="delVisible = false">取 消</el-button>
            <el-button type="primary" @click="deleteRow">确 定</el-button>
        </span>
    </el-dialog>

解决~

猜你喜欢

转载自blog.csdn.net/adley_app/article/details/84254727