vue实现树形可折叠菜单效果代码

代码语言:html

所属分类:菜单导航

代码描述:vue实现树形可折叠菜单效果代码

代码标签: 可折叠 菜单 效果

下面为部分代码预览,完整代码请点击下载或在bfwstudio webide中打开


<!DOCTYPE html>
<html lang="en">
<head>
  <meta charset="utf-8">
<style>
body{
    background: white;
}
    *{
	box-sizing: border-box;
	margin: 0;padding: 0;
}
*:before,*:after{
	box-sizing: border-box;
}
ul,
li {
	list-style: none;
}

.l_tree_container {
	height: 100%;
	margin: 13px;
	position: relative;
}

.l_tree {
	width: calc(100% - 44px);
	height: 100%;
	padding-left: 42px;
}
.l_tree_branch {
	width: 100%;
	height: 100%;
	display: block;
	padding: 13px;
	position: relative;
}

.l_tree_branch .l_tree_children_btn {
	width: 26px;
    height: 26px;
    border-radius: 50%;
    background-color: #2283c1;
    font-size: 23px;
    text-align: center;
    color: #ffffff;
    outline: none;
    border: 0;
    cursor: pointer;
}

ul.l_tree:before {
	content: '';
	border-left: 1px solid #999999;
	height: calc(100%);
	position: absolute;
	left: 10px;
	top: 0px;
}

.l_tree .l_tree_branch:last-child::before {
	content: '';
	width: 3px;
	height: calc(100% - 24px);
	display: block;
	background-color: #ffffff;
	position: absolute;
	bottom: 0;
	left: -34px;
}

.l_tree,
.l_tree_branch {
	position: relative;
}

.l_tree_branch::after {
	content: '';
	width: 40px;
	height: 0;
	border-bottom: 1px solid #000;
	position: absolute;
	right: calc(100% - 9px);
	top: 22px;
}

.l_tree_container>.l_tree::before,
.l_tree_container>.l_tree>.l_tree_branch::after {
	display: none;
}
.l_folder{
    border-radius: 5px;
    border: 3px #096eae solid;
    padding: 2px 10px 2px 10px;
}
</style>
<body>
	<div id="app" v-cloak>
		<!-- 树状菜单 -->
		<div>
			<div class="l_tree_container">
				<ew-tree :model="testdata"></ew-tree>
			</div>
		</div>
	</div>
<script type="text/javascript" src="//repo.bfw.wiki/bfwrepo/js/vue@2.6.1.js"></script>
  <script type="text/javascript">
  Vue.component('ew-tree', {
      template: `
      <ul class="l_tree">
          <li class="l_tree_branch" v-for="item in model" :key="item.id">
              <div class="l_tree_click">
                  <button type="button&qu.........完整代码请登录后点击上方下载按钮下载查看

网友评论0