layui如何自定义弹出层关闭事件

在某些业务场景下,我们需要自定义弹出层关闭事件,代码示例如下:

layui.use('layer', function () {

        var layer = layui.layer;

        layer.open({
            skin: 'demo-class',
            type: 1,
            title: '登录',
            area: ['600px', '700px'],
            closeBtn :0,
            content: $('.login'), //这里content是一个普通的String
            cancel: function () {
                vscode.postMessage({
                    command: 'close'
                });
            }
        });
    });

 

posted @ 2019-06-22 21:13  挑战者V  阅读(12715)  评论(0编辑  收藏  举报