.heart{width: 10px;height: 10px;position: fixed;background: #f00;transform: rotate(45deg);-webkit-transform: rotate(45deg);-moz-transform: rotate(45deg);}.heart:after,.heart:before{content: '';width: inherit;height: inherit;background: inherit;border-radius: 50%;-webkit-border-radius: 500%;-moz-border-radius: 50%;position: fixed;}.heart:after{top: -5px;}.heart:before{left: -5px;}

翔奕时代

A year's plan starts with spring.

温柔正确的人总是难以生存,因为这世界既不温柔,也不正确。
0%

x-admin使用的问题整理

1、登录失效如何跳转外层页面

当登录失效时,如果使用header(“location:/admin/login”);的方式跳转,就会在内层页面跳转到登录页面,体验非常不好,正确应该使用下面的跳转能跳转到外层页面的登录

1
exit('<script>top.location.href= "/admin/login"</script>'); 

2、如何弹窗页面保存完后跳转并刷新父级页面

1
2
3
4
5
6
// 获得frame索引
var index = parent.layer.getFrameIndex(window.name);
//关闭当前frame
parent.layer.close(index);
// 父页面刷新
parent.location.reload();

3、弹窗页面如何更好的提交体验

1
2
3
4
5
6
7
8
9
10
11
12
13
14
15
16
17
18
19
20
21
22
//监听提交
form.on('submit(add)', function(data){
console.log(data);
var a = true;

$.post('/admin/menu_save', data.field, function(res){
res = JSON.parse(res);
if(res.success){
// 获得frame索引
var index = parent.layer.getFrameIndex(window.name);
//关闭当前frame
parent.layer.close(index);
// 父页面刷新
parent.location.reload();
return false;
} else {
layer.msg(res.msg)
return false;
}
});
return false; // 这个return false一定要加
});