Create your Gitee Account
Explore and code with more than 6 million developers,Free private repositories !:)
Sign up
Clone or download
onelevel.html 3.32 KB
Copy Edit Web IDE Raw Blame History
<!DOCTYPE html>
<html lang="en">
<head>
<meta charset="UTF-8">
<meta name="viewport" content="width=device-width, initial-scale=1.0">
<meta http-equiv="X-UA-Compatible" content="ie=edge">
<title>Document</title>
<link rel="stylesheet" href="./plugins/layui/css/layui.css" media="all">
</head>
<body style="margin:15px;">
<h3>先看着代码哇,文档后面有时间再写(或者,谁愿意帮我写?)..</h3>
<pre class="layui-code">
//处理顶部一级菜单
var onelevel = layui.onelevel;
if (onelevel.hasElem()) {
onelevel.set({
remote: {
url: '/datas/onelevel1.json' //远程地址
},
onClicked: function(id) {
switch (id) {
case 1:
navbar.set({
remote:
{
url:
'/datas/navbar1.json'
}
}).render(function(data) {
tab.tabAdd(data);
});
break;
case 2:
navbar.set({
remote:
{
url:
'/datas/navbar2.json'
}
}).render(function(data) {
tab.tabAdd(data);
});
break;
default:
navbar.set({
data:
[{
id:
"1",
title: "基本元素",
icon: "fa-cubes",
spread: true,
children: [{
id: "7",
title: "表格",
icon: "&#xe6c6;",
url: "test.html"
},
{
id: "8",
title: "表单",
icon: "&#xe63c;",
url: "form.html"
}]
},
{
id: "5",
title: "这是一级导航",
icon: "fa-stop-circle",
url: "https://www.baidu.com",
spread: false
}]
}).render(function(data) {
tab.tabAdd(data);
});
break;
}
}
}).render();
}</pre>
</body>
</html>

Comment ( 0 )

Sign in for post a comment