Recently, WHEN I was working on a background project, I happened to encounter the use of layer.open, so I would like to record it conveniently, so that I can meet a reference in the future – 11/7, 2016

Layer is a web layer component… Then the project framework is SSM…

Layer. open is basically used to pop up an iframe, and then it’s used to display the data, it’s used to modify the data, it’s used to display the data, it’s used to display the page I need…

layer.open({

Type: 1, title: 'Account Details ', shadeClose: true, shade: false, maxmin: true, // Turn on maxmin button area: ['893px', '600px'], Content: xxxxxxxxx

});

Don’t look at anything else, just look at content, because content is what you want to show

The first method, very simple, I want to look at an existing page, such as Baidu, or a page in the project directly write the address

layer.open({

Type: 2, title: 'A lot of times, we want to maximize look, like this page. Area: ['893px', '600px'], Content: 'http://fly.layui.com/' });

layer.open({

Type: 2, title: 'User information. Area: ['893px', '600px'], Content: '/test/user/info' + uid });

The uid in the back may be some parameter you need to pass… It depends on your controller

The second method is to write what you want to the page and then call it when you use it

The JSP page:

<div id=’info’ style = “display : none”>

I am content

</div>

And then call it in JS

layer.open({

Type: 1, title: 'Account Details ', shadeClose: true, shade: false, maxmin: true, // Turn on maxmin button area: ['893px', '600px'], Content: $("#info").html()

});

The third method, directly in js splicing… Very cruel…

var html = “<div class=’wrapper’ id=’detailsinfo’>” +

"< div class = 'detailsdiv' >" + "< p > < label > account: < / label >" + 'test account + "< / p >" + "< / div > < / div >"

layer.open({

Type: 1, title: 'Account Details ', shadeClose: true, shade: false, maxmin: true, // Turn on maxmin button area: ['893px', '600px'], Content: html

});

I am using these three methods now, maybe there is a better method, later found to record

For method 1: Since you’re using an existing controller and page, it’s easier to pass whatever value you want, get whatever value you need, and pass whatever value you need… But there may be some pages that I don’t want people to access directly through the URL… Then you can use the second and the third… The required data is fetched directly from the background through Ajax, then placed in a specific location, and then displayed ~~