Welcome to OStack Knowledge Sharing Community for programmer and developer-Open, Learning and Share
Welcome To Ask or Share your Answers For Others

Categories

0 votes
1.3k views
in Technique[技术] by (71.8m points)

layui弹出层怎么样修改使点击按钮关闭当前页面

;!function(){

//页面一打开就执行,放入ready是为了layer所需配件(css、扩展模块)加载完毕
layer.ready(function(){ 
layer.open({
        type: 1
        ,title: false //不显示标题栏
        ,closeBtn: false
        ,area: '45%;'
        ,shade: 0.8
        ,id: 'LAY_layuipro' //设定一个id,防止重复弹出
        ,btn: ['确定', '拒绝']
        ,btnAlign: 'c'
        ,moveType: 1 //拖拽模式,0或者1
        ,content: '<div style="padding: 30px; line-height: 22px; background-color: #393D49; color: #fff; font-weight: 300;"><p style="text-align:center;">欢迎使用Layui!</div>'
        ,success: function(layero){
          var btn = layero.find('.layui-layer-btn');
          btn.find('.layui-layer-btn1').attr({
            href: 'http://www.layui.com/'
            ,target: '_blank'
          });
        }
      });
});
}();

现在点击拒绝按钮是跳转到一个新页面,想修改成点击拒绝按钮,关闭当前整个网页,应该怎么修改?谢谢!


与恶龙缠斗过久,自身亦成为恶龙;凝视深渊过久,深渊将回以凝视…
Welcome To Ask or Share your Answers For Others

1 Answer

0 votes
by (71.8m points)

image.png
这块儿应该就是点击按钮的逻辑呀,改成window.close()试一下。


与恶龙缠斗过久,自身亦成为恶龙;凝视深渊过久,深渊将回以凝视…
Welcome to OStack Knowledge Sharing Community for programmer and developer-Open, Learning and Share
Click Here to Ask a Question

...