Button 本页跳转

develop
就眠仪式 2021-02-20 17:11:38 +08:00
parent 752d3b22f4
commit 490fead502
3 changed files with 68 additions and 20 deletions

View File

@ -42,9 +42,7 @@ layui.define(['table', 'jquery', 'element', 'yaml','form', 'tab', 'menu', 'frame
this.readConfig = function() {
if (configType === "yml") {
return yaml.load(configPath);
}
else
{
} else {
let data;
$.ajax({
url: configPath,
@ -93,7 +91,8 @@ layui.define(['table', 'jquery', 'element', 'yaml','form', 'tab', 'menu', 'frame
refreshA.addClass("layui-anim-rotate");
refreshA.addClass("layui-anim-loop");
refreshA.addClass("layui-icon-loading");
bodyTab.refresh(400);
if (param.tab.muiltTab) bodyTab.refresh(400);
else bodyFrame.refresh(400);
setTimeout(function() {
refreshA.addClass("layui-icon-refresh-1");
refreshA.removeClass("layui-anim");

View File

@ -39,6 +39,21 @@ layui.define(['table', 'jquery', 'element'], function (exports) {
}
}
pearFrame.prototype.changePageByElement = function(elem,url,title,loading){
if(loading){
var loading = $("#"+elem).find(".pear-frame-loading");
loading.css({display:'block'});
}
$("#"+elem+" iframe").attr("src",url);
$("#"+elem+" .title").html(title);
if(loading){
var loading = $("#"+elem).find(".pear-frame-loading");
setTimeout(function(){
loading.css({display:'none'});
},800)
}
}
pearFrame.prototype.refresh = function (time) {
if(time!=false){
var loading = $("#"+this.option.elem).find(".pear-frame-loading");

View File

@ -233,6 +233,36 @@
</div>
</div>
</div>
<div class="layui-col-md12">
<div class="layui-card">
<div class="layui-card-header">
Load 手动
</div>
<div class="layui-card-body">
<button class="pear-btn pear-btn-primary" to> 本页跳转 </button>
</div>
</div>
</div>
<div class="layui-col-md12">
<div class="layui-collapse">
<div class="layui-colla-item">
<h2 class="layui-colla-title">显示代码</h2>
<div class="layui-colla-content">
<pre class="layui-code" lay-encode="true">
layui.use(["jquery"], function() {
var $ = layui.jquery;
$("[to]").click(function(){
top.layui.frame.changePageByElement("content","http://www.baidu.com","百度一下",true)
})
})
</pre>
</div>
</div>
</div>
</div>
</div>
<script src="../../component/layui/layui.js"></script>
<script src="../../component/pear/pear.js"></script>
@ -268,6 +298,10 @@
popup.failure("已停止");
});
})
$("[to]").click(function(){
top.layui.frame.changePageByElement("content","http://www.baidu.com","百度一下",true)
})
})
</script>
</body>