vue使用v-for实现多级菜单效果代码
代码语言:html
所属分类:菜单导航
代码描述:vue使用v-for实现多级菜单效果代码
下面为部分代码预览,完整代码请点击下载或在bfwstudio webide中打开
<!DOCTYPE html> <html> <head> <meta charset="UTF-8"> <style> .level-one{ text-indent: 1em; } .level-two{ text-indent: 2em; } .level-three{ text-indent: 3em; } </style> </head> <body> <div id="app"> <div class="level-one" v-if="obj.level == 1" v-for="obj in bar1"><a>{{obj.title}}</a> <div class="level-two" v-if="obj1.parentId == obj.id " v-for="obj1 in bar1"><a>{{obj1.title}}</a> <div class="level-three" v-if="obj2.parentId == obj1.id" v-for="obj2 in bar1"><a>{{obj2.title}}</a></div> </div> </div> </div> <script type="text/javascript" src="//repo.bfw.wiki/bfwrepo/js/vue.2.2.min.js"></script> <script> new Vue({ el: '#app', .........完整代码请登录后点击上方下载按钮下载查看
网友评论0