element icon indicating copy to clipboard operation
element copied to clipboard

Dialog BUG,弹框内再点弹框,样式错误。

Open zhongmengyuan opened this issue 9 years ago • 10 comments

1.弹框内二级弹框不应该指定一级弹框(当前弹框)为window对象,因为如果二级弹框比一级弹框大,页面将其丑无比,弹框无法使用 2.弹框是否显示(isShow),应该使用v-if 绑定,而不是用过v-show 绑定;因为弹框打开时大多情况需要传入数据再mount

zhongmengyuan avatar Jan 16 '17 08:01 zhongmengyuan

  1. 不要嵌套使用 Dialog
  2. Dialog 的 body 是通过 v-if 控制的。

Leopoldthecoder avatar Jan 17 '17 02:01 Leopoldthecoder

1.因为不能嵌套使用Dialog,,但是个人觉得体验不是太好,做得更好一点应该是支持Dialog嵌套的
2.  把下面代码拷过去运行一下,你会发现点击关闭上一层Dialog之后,下一层Dialog的遮罩层就没了。这对于把常用Dialog做出组件非常有必要。
  <script src="//unpkg.com/vue/dist/vue.js"></script>
  <script src="//unpkg.com/element-ui/lib/index.js"></script>
  <div id="app">
    <el-button type="text" @click="dialogVisible1 = true;dialogVisible2= true;">点击打开 Dialog
    </el-button>
    <div v-if="dialogVisible1==true">
        <el-dialog title="提示" v-model="dialogVisible1" size="small">
            <span>这是一段信息</span>
            <span slot="footer" class="dialog-footer">
                <el-button @click="dialogVisible = false">取 消</el-button>
                <el-button type="primary" @click="dialogVisible2 = true">确 定</el-button>
            </span>
        </el-dialog>
    </div>
</div>
var Main = {
    data() {
        return {
            dialogVisible1: false,
            dialogVisible2: false,
        };
    }
};
var Ctor = Vue.extend(Main)
new Ctor().$mount('#app')

zhongmengyuan avatar Jan 17 '17 06:01 zhongmengyuan

你的代码中并没有两个 Dialog。

「不要嵌套使用 Dialog」并不是说页面上不能同时存在多个 Dialog,只是它们在模板中的层级关系不要嵌套而已:http://jsfiddle.net/o8t21h4u/

Leopoldthecoder avatar Jan 17 '17 06:01 Leopoldthecoder

直接上代码:刚才代码拷贝的时候出错了,你直接 : http://jsfiddle.net/o8t21h4u/3/

zhongmengyuan avatar Jan 17 '17 06:01 zhongmengyuan

链接点击跳转不过去,你把链接拷到浏览器打开就行了

zhongmengyuan avatar Jan 17 '17 07:01 zhongmengyuan

问题的原因是产生遮罩的位置,遮罩是产生在dialog节点 同级的下一个,而且永远只有一个,如果第二个dialog上一级还有一个(div v-if='a'),当 a=false的时候会将div下面的dialog和遮罩一起去除,这就造成上一个弹出框还在但是遮罩没了的情况 @Leopoldthecoder 不知道我表达明白没有

seven-yu avatar Jan 17 '17 07:01 seven-yu

#2556 http://jsfiddle.net/o8t21h4u/3/ 修复了这个 demo 的问题。由于涉及到 DOM 结构的改变,属于非兼容性更新,会随 1.2.0 版本发布。

Leopoldthecoder avatar Jan 21 '17 09:01 Leopoldthecoder

thanks

seven-yu avatar Jan 21 '17 09:01 seven-yu

elementUi dialog多个嵌套的时候会出现遮罩层错误 大家是怎么解决的呢 代码结构如下 <ProductDocumentDialog

   ></ProductDocumentDialog>
   <span slot="footer" class="dialog-footer">
<el-button @click="cancle">取 消</el-button>
<el-button type="primary" @click="sure">确 定</el-button>
</span>
 </el-dialog>

ProductDocumentDialog这也是一个组件,里面嵌套的有封装好的上传dialog ,但是在点击一个按钮的时候页面的第一层出现遮罩 ,层级出现问题,有好的解决方案吗??

jim888666 avatar Sep 20 '17 06:09 jim888666

@jim888666 看我CSDN博客,完美解决弹框嵌套调用以及遮罩层相互影响的问题http://blog.csdn.net/zmy_coder/article/details/78042485

zhongmengyuan avatar Sep 20 '17 10:09 zhongmengyuan