Vue实现tab选项卡
2018-04-27 11:15
295 查看
Vue实现tab选项卡
<!DOCTYPE html> <html lang="en"> <head> <meta charset="UTF-8"> <title>Tabs</title> <style> .active{ background: #f00; } </style> <script src="https://unpkg.com/vue/dist/vue.js"></script> </head> <body> <div id="app"> <ul> <li @click="toggle(index ,tab.view)" v-for="(tab,index) in tabs" :class="{active:active===index}"> {{tab.type}} </li> </ul> <component :is="currentView"></component> </div> </body> </html> <script> Vue.component('child1', { template: "<p>this is child1</p>" }) Vue.component('child2', { template: "<p>this is child2</p>" }) new Vue({ el: "#app", data: { active: 0, currentView: 'child1', tabs: [ { type: 'tab1', view: 'child1' }, { type: 'tab2', view: 'child2' } ] }, methods: { toggle(i, v){ this.active = i this.currentView = v } } }) </script>
演示地址: https://xibushijie.github.io/static/vuetab.html
posted @ 2018-04-27 4000 11:15 <_/> 阅读(...) 评论(...) 编辑 收藏相关文章推荐
- Vue.js组件tab实现选项卡切换
- Vue.js tab实现选项卡切换
- vue + element tab选项卡 实现。。。
- 使用Android Support Design 控件TabLayout 方便快捷实现选项卡功能
- 【Android UI设计与开发】第11期:顶部标题栏(二)ActionBar实现Tab选项卡和下拉导航列表
- jquery实现超简洁的TAB选项卡效果代码
- jQuery实现tab选项卡效果的方法
- 使用TabLayout和ViewPager实现左右滑动选项卡
- 学习的步伐(二)Kotlin 实现Recyclerview列表(补充:tab选项卡+CoordinatorLayout收缩布局+复杂Recyclerview列表)
- bootstrap + js类 + vue.js实现tab
- vue子路由跳转实现tab选项卡
- Android用RadioGroup控件实现Tab选项卡效果
- ViewPager+Fragment实现TabHost,Fragment动态添加、删除,Tab选项卡跟随滑动
- # 整理4种实现tab选项卡的方式 by angular
- 用ionic(选项卡栏tab) icon(图标) ionic上拉菜单(ActionSheet) 实现通讯录界面切换操作
- 【Android UI设计与开发】第11期:顶部标题栏(二)ActionBar实现Tab选项卡和下拉导航列表
- vue中用动态组件实现选项卡切换效果
- BootStrap实现左侧或右侧竖式tab选项卡
- 【Android UI设计与开发】第11期:顶部标题栏(二)ActionBar实现Tab选项卡和下拉导航列表
- jquery插件tytabs.jquery.min.js实现渐变TAB选项卡效果