打开el-dialog
时间: 2023-10-02 20:04:35 浏览: 134
显示对话框
打开el-dialog时,如果已经有一个el-dialog已经打开了,再次打开一个el-dialog会出错。此时,可以新打开的el-dialog中设置append-to-body="true",具体代码如下:
```html
<template>
<el-dialog title="表单" :close-on-click-modal="false" width="80%" :append-to-body="true" :visible.sync="visible">
</el-dialog>
</template>
```
设置append-to-body="true"的原因是因为再次打开带有滚动条的dialog时,滚动条会回到上次打开的位置,而不是置顶。通过将el-dialog插入到body元素上,可以解决这个问题。<span class="em">1</span><span class="em">2</span><span class="em">3</span>
#### 引用[.reference_title]
- *1* [在el-dialog中打开 el-dialog](https://blog.csdn.net/kan_Feng/article/details/126547395)[target="_blank" data-report-click={"spm":"1018.2226.3001.9630","extra":{"utm_source":"vip_chatgpt_common_search_pc_result","utm_medium":"distribute.pc_search_result.none-task-cask-2~all~insert_cask~default-1-null.142^v92^chatsearchT0_1"}}] [.reference_item style="max-width: 33.333333333333336%"]
- *2* [解决再次打开el-dialog里面el-form的滚动条不置顶](https://blog.csdn.net/qq_43513818/article/details/123568772)[target="_blank" data-report-click={"spm":"1018.2226.3001.9630","extra":{"utm_source":"vip_chatgpt_common_search_pc_result","utm_medium":"distribute.pc_search_result.none-task-cask-2~all~insert_cask~default-1-null.142^v92^chatsearchT0_1"}}] [.reference_item style="max-width: 33.333333333333336%"]
- *3* [el-dialog打开与关闭的几种方式](https://blog.csdn.net/qq_41520636/article/details/125329708)[target="_blank" data-report-click={"spm":"1018.2226.3001.9630","extra":{"utm_source":"vip_chatgpt_common_search_pc_result","utm_medium":"distribute.pc_search_result.none-task-cask-2~all~insert_cask~default-1-null.142^v92^chatsearchT0_1"}}] [.reference_item style="max-width: 33.333333333333336%"]
[ .reference_list ]
阅读全文