pwindy  
在完成任务的同时,还需要不断“复盘”,不论你多么的忙,都需要留下时间思考,可以思考哪些地方做的好,哪些地方我们可以改进,应该如何改进,注重总结才是王道

方法一: 把弹窗事件写在layer.ready里面

             layer.ready(function() {
                  var index = layer.load(2);
                  layer.open({
                        type: 1,
                        title: false,
                        closeBtn: 0,
                        shadeClose: true,
                        area: ['200px', 'auto'],
                        content: '<img class="closeCode" src="' + dataimg + '" width="100%" />',
                   });
                   layer.close(index);
              });

 

方法二: 在成功以后修改样式

              layer.open({
                    type: 1,
                    title: false,
                    closeBtn: 0,
                    shadeClose: true,
                    area: ['200px', 'auto'],
                    content: '<img class="closeCode" src="' + dataimg + '" width="100%" />',
                    success:function(layero,index){
                    layer.style(index, {
                          top: '50%',
                          transform:'translateY(-50%)'
                   });
               }
             });

 

方法三: 写个固定的宽高

           layer.open({
                type: 1,
                title: false,
                closeBtn: 0,
                shadeClose: true,
                area: ['200px', '200px'],
                content: '<img class="closeCode" src="' + dataimg + '" width="100%" />',
           });

 

 

参考---https://blog.csdn.net/qq_33769914/article/details/97009173?spm=1001.2101.3001.6650.10&utm_medium=distribute.pc_relevant.none-task-blog-2%7Edefault%7ECTRLIST%7Edefault-10.highlightwordscore&depth_1-utm_source=distribute.pc_relevant.none-task-blog-2%7Edefault%7ECTRLIST%7Edefault-10.highlightwordscore

posted on 2021-12-13 15:27  pwindy  阅读(783)  评论(0)    收藏  举报