vue菜鸟 请教如何实现
点击冰箱 出现 冰箱下的二级菜单
点击酒柜 出现酒柜的二级菜单 冰箱的隐藏
以此类推
<div id="app"> <ul> <li v-for="(item,index) in tabs" :class="{active:index == num}" @click="tab(index)">{{item}}</li> </ul> <div class="tabCon"> <div v-for='(itemCon,index) in tabContents' v-show=" index == num">{{itemCon}}</div> </div> </div><!--这里是js代码--><script type="text/javascript">var vm = new Vue({ el: '#app', data: { tabs: ["冰箱", "酒柜","菜多多"], tabContents: ["馨厨S系列","内容二","内容三"], num: 1 }, methods: { tab(index) { this.num = index; } }});</script>这样写的话 冰箱智能绑定 馨厨S系列 其他两个无法写 写成数组 就无法显示了应该怎么改
相似问题