子窗体JS代码
1 2 3 4 5 6 7 8 9 10 11 12 | <script src= "~/lib/ueditor-1.4.3.3/ueditor.config.js" ></script> <script src= "~/lib/ueditor-1.4.3.3/ueditor.all.js" ></script> <script> var ue = UE.getEditor( 'container' , { initialFrameHeight: 300, initialFrameWidth: 900 }); var callbackdata = function () { var editorHtml = ue.getContent(); //获取富文本内容 return editorHtml; } </script> |
1 2 3 4 5 6 7 8 9 10 11 12 13 14 15 16 17 18 19 20 21 22 23 24 25 26 27 | var body; layer.open({ title: '添加用户信息' , type: 2, shade: false , maxmin: true , shade: 0.5, btn: [ '确认' , '取消' ], area: [ '500px' , '400px' ], content: 'ArticleEdit' , zIndex: layer.zIndex, success: function (layero, index) { body = layui.layer.getChildFrame( 'body' , index); //获取子窗体 body内容 }, yes: function (index, layero) { var vvv = $(layero).find( "iframe" )[0].contentWindow.callbackdata(); //这里是调用子页面的方法,并且 方法返回的内容 console.log(vvv); var userName = body.contents().find( "#userName" ).val(); //假如子窗体有一个ID为userName的input 这里就是获取这个input的内容 layer.closeAll(); }, btn2: function () { //alert("222"); 取消时触发 }, end: function () { //关闭窗体时 触发 } }); |