layui搭建后台

Original 2018-12-06 15:22:15 283
abstract:// layui.use(['layer','form'],function(){ //     var layer = layui.layer //     ,form = layui.form; //&n
// layui.use(['layer','form'],function(){
//     var layer = layui.layer
//     ,form = layui.form;
//     layer.msg('this is my first layui!');
// })
//模块化用法
// layui.config({
//     base:'/layui/res/js/modules/'
// }).use('modules');

//轮播
layui.use(['carousel','form'],function(){
var carousel1 = layui.carousel
,form = layui.form;
carousel1.render({
elem:'#name'
,width:'1200px'
,height:'450px'
,interval:3000
,arrow:'hover'
,anim:'default'
})
})
/* 退出按钮 */ 
layui.use(['form','element','layer'],function(){
var form = layui.form
,element = layui.element
,layer = layui.layer;
menuHeght();
contentHeght();
})
/* 设置侧边自适应高度 */
function menuHeght(){
var height = document.documentElement.clientHeight-50;
$('.menu').height(height);
}
function refun(){
layui.use(['form','element','layer'],function(){
var form = layui.form
,element = layui.element
,layer = layui.layer;
})
layer.confirm('确定要退出么?', {
offset: '300px'
,icon:3
,btn: ['确定', '取消'] //可以无限个按钮
}, function(index, layero){
return true;
}, function(index){
return false;
});
}
/* 删除按钮 */
function del(){
layui.use(['form','element','layer'],function(){
var form = layui.form
,element = layui.element
,layer = layui.layer;
})
layer.confirm('确定要退出么?', {
offset: '200px'
,shade:0
,icon:3
,btn: ['确定', '取消'] //可以无限个按钮
}, function(index, layero){
return true;
}, function(index){
return false;
});
}
/* menuShow */ 
function menuShow(obj){
var menuCon = $(obj).attr('src');
$('iframe').attr('src',menuCon);
}
//设置content自适应高度 
function contentHeght(){
var height = document.documentElement.clientHeight-70;
$('.fram').height(height);
}

layui.png

Correcting teacher:韦小宝Correction time:2018-12-06 15:39:08
Teacher's summary:恩!写的很不错,要想熟练还是要多练习哦!

Release Notes

Popular Entries