- 使用的版本 layui-v2.5.6
- 是在父页面弹出层,显示;调用的是父页面的layer.open();
父页面:
<link href="/layui/css/layui.css" rel="stylesheet" />
<script src="/layui/layui.all.js"></script>
<script src="/script/jquery-1.11.3.min.js"></script>
<script type="text/javascript">
layui.use(['form', 'element', 'layer', 'util', 'laypage'], function () {
var form = layui.form
, layer = layui.layer
, util = layui.util
, element = layui.element
, laypage = layui.laypage;
});
</script>
子页面
<link href="/layui/css/layui.css" rel="stylesheet" />
<script src="/layui/layui.js"></script>
<script src="/script/jquery-1.11.3.min.js"></script>
<a class="button text-btn" href="javascript:pageConfig.publishWindow('108170163748288' );" style="background:#339900 ;color:#ffffff;padding:2px 4px;border-radius:3px;"><i class="layui-icon layui-icon-release"></i>发布</a>
<script type="text/template" id="win_publish_div">
<div id="win_wzpublish" class="layui-form" style=" padding:20px; " lay-filter="winpublish">
<div class="layui-form" style="padding:20px;">
<div class="layui-form-item">
<select name="selwin_wzpublish" id="selwin_wzpublish">
<option value="">请选择发布到的栏目</option>
<option value="28a18413-9952-41d6-dc97-08dad8ef948e">头条新闻</option>
<option value="721171be-9c30-4f25-fa15-08dadb8890d7">勘研动态</option>
<option value="3e0ce84e-91a9-47cf-dc96-08dad8ef948e">通知公告</option>
</select>
</div>
<div style=" ">
<button class="layui-btn layui-bg-orange" id="btnPreview">发布预览</button>
<button class="layui-btn " id="btnPublish" style="margin-left:30px;">确定发布</button>
</div>
</div>
</div>
</script>
<script type="text/javascript">
var parentDOM = top || window;
layui.use(['laydate', 'form', 'element'] , function(){
var laydate = layui.laydate;
日期时间选择器
//laydate.render({
// elem: '#orderPublishDate',
// type: 'datetime'
//});
//laydate.render({
// elem: '#orderEndPublishDate',
// type: 'datetime'
//});
});
!function (p) {
//发布窗口
p.publishWindow = function (articleId) {
var width = window.innerWidth - 30;
if (window.innerWidth >= 1024) {
width = 900;
}
var boxSize = [width + 'px', '800px'];
var index = parentDOM.layer.open({
type: 1,
offset: 'auto',
title: '发布文章',
area: boxSize, //宽高
content: $("#win_publish_div").html(),
success: function (layero, index, that) {
var winDom = parentDOM.$("win_wzpublish");
parentDOM.layui.form.render(null, "winpublish");
var laydate = parentDOM.layui.laydate;
//日期时间选择器
laydate.render({
elem: '#orderPublishDate',
type: 'datetime'
});
laydate.render({
elem: '#orderEndPublishDate',
type: 'datetime'
});
}
});
}
}(pageConfig);
文章来源地址https://www.toymoban.com/news/detail-744588.html
文章来源:https://www.toymoban.com/news/detail-744588.html
到了这里,关于layer.open再次渲染html,子页面调用在父页面打开弹出层,渲染html的文章就介绍完了。如果您还想了解更多内容,请在右上角搜索TOY模板网以前的文章或继续浏览下面的相关文章,希望大家以后多多支持TOY模板网!