您的当前位置:首页bootstrap有树状菜单吗

bootstrap有树状菜单吗

2020-11-27 来源:爱问旅游网
bootstrap-treeview.js是一款强大的树菜单插件,本文演示bootstrap-treeview.js的调用方法。

它可一次性加载数据,也可异步加载。支持Checkbox,selectable,节点级联等,而且还能承载大数据。

使用方法(推荐学习:Bootstrap视频教程)

<!doctype html>
<html>
 <head>
 <meta charset="UTF-8">
 <meta http-equiv="X-UA-Compatible" content="IE=edge,chrome=1">
 <meta name="viewport" content="width=device-width, initial-scale=1.0">
 <title>treeview+bootstrap多级下拉树插件</title>
 <link href="//cdn.bootcss.com/bootstrap/3.2.0/css/bootstrap.min.css" rel="stylesheet">
 <style type="text/css">
 .shouce-header{margin-bottom: 15px;font-family: "Segoe UI", "Lucida Grande", Helvetica, Arial, "Microsoft YaHei", FreeSans, Arimo, "Droid Sans", "wenquanyi micro hei", "Hiragino Sans GB", "Hiragino Sans GB W3", "FontAwesome", sans-serif;}
 .shouce-icon{color: #fff;}
 </style>
 <!--[if IE]>
 <script src="//cdn.bootcss.com/html5shiv/3.7.3/html5shiv.min.js"></script>
 <![endif]-->
 </head>
<body>
<div id="treeview1"></div>
<script>
var defaultData = [ 
 { 
 text: 'Parent 1', 
 href: '#parent1', 
 tags: ['4'], 
 nodes: [ 
 { 
 text: 'Child 1', 
 href: '#child1', 
 tags: ['2'], 
 nodes: [ 
 { 
 text: 'Grandchild 1', 
 href: '#grandchild1', 
 tags: ['0'] 
 }, 
 { 
 text: 'Grandchild 2', 
 href: '#grandchild2', 
 tags: ['0'] 
 } 
 ] 
 }, 
 { 
 text: 'Child 2', 
 href: '#child2', 
 tags: ['0'] 
 } 
 ] 
 }, 
 { 
 text: 'Parent 2', 
 href: '#parent2', 
 tags: ['0'] 
 }, 
];
$('#treeview1').treeview({ 
 data: defaultData 
}); 
</script>
</body>
</html>

更多Bootstrap相关技术文章,请访问Bootstrap教程栏目进行学习!

显示全文