想要动态修改弹层layer.open的css样式。
可以先尝试使用:
layer.style(layerIndex,{
width:'100px'
});
但是,我测试时,layer.open 如果type为2时,使用的是iframe,
在iframe页内失效。
所以做了一下适配:
//iframe页内获得layer.open的index唯一索引
let selfIndex=parent.layer.getFrameIndex(window.name);
//例如修改宽度
$('#layui-layer'+selfIndex,window.parent.document).css({width:'100%'});
行了,特此记录。
附:layui并不是适合所有业务逻辑,虽然功能如此强大,没有之一,但是,
有时候,需要你自己Diy一下适合自己。