banner
leoking

leoking

前端开发者
tg_channel

In version 2 of Vue, why does the element dialog component display a gray overlay layer when two el-dialog components are displayed on the page at the same time?

In Vue 2, when using Element UI 2.x version, if you display two el-dialog components on the page at the same time, there may be a problem with the gray overlay. This is because the el-dialog component by default uses a global overlay to prevent user interaction with other page elements. When multiple el-dialog components appear at the same time, the default global overlay will cause a gray overlay to appear.

To solve this problem, you can set the modal attribute to false for each el-dialog component, which will prevent the appearance of the global overlay. For example:

<template>
  <div>
    <el-dialog :visible="dialog1Visible" :modal="false">
      <!-- Dialog 1 content -->
    </el-dialog>
    
    <el-dialog :visible="dialog2Visible" :modal="false">
      <!-- Dialog 2 content -->
    </el-dialog>
  </div>
</template>

<script>
export default {
  data() {
    return {
      dialog1Visible: false,
      dialog2Visible: false
    }
  }
  // ...
}
</script>

By setting the modal attribute of each el-dialog component to false, you can display multiple el-dialog components at the same time without the gray overlay appearing.

Loading...
Ownership of this post data is guaranteed by blockchain and smart contracts to the creator alone.