element-ui中弹框dialog不显示,仅背景变灰
程序员文章站
2024-03-24 09:11:46
...
1.问题描述
根据element官网的对话框代码,使用时会发现弹框不显示,需要增加一个属性
:append-to-body="true"
2.加上之后效果
<template>
<el-button type="text" size="mini" @click="copyPanel = true">复制</el-button>
<el-dialog
title="复制仪表板"
:visible.sync="copyPanel"
:append-to-body="true"
width="530px">
<el-form size="small" :model="formCopyPanel" ref="formCopyPanel" label-width="109px">
<el-form-item label="复制到">
<el-select v-model="formCopyPanel.position" placeholder="" style="width: 360px;">
<el-option label="仪表板" value="仪表板"></el-option>
<el-option label="来点原因分析" value="来点原因分析"></el-option>
</el-select>
</el-form-item>
</el-form>
<div slot="footer" class="dialog-footer">
<el-button @click="copyPanel = false">取 消</el-button>
<el-button type="primary" @click="copyPanel = false">确 定</el-button>
</div>
</el-dialog>
</template>