您的位置:首页技术文章
文章详情页

vue实现顶部菜单栏

【字号: 日期:2022-11-04 13:14:36浏览:31作者:猪猪

vue实现顶部菜单栏,同一个页面两个菜单按钮之间的切换

先看展示结果:点击第一个按钮,显示内容1 点击第二个按钮,展示内容2

vue实现顶部菜单栏

vue实现顶部菜单栏

下面上源码:注意哦,一定要代码规划,别学我(⊙o⊙)

<template><div> <div class='tab-content'> <div @click='cur=1' :class='{active:cur==1}'><span>数据标注</span> </div> <div @click='cur=2' :class='{active:cur==2}'>案件数</div> </div> <div class='tab'> <div v-show='cur==1'> <div>内容1</div> </div> <div v-show='cur==2'> <div>内容2</div> </div> </div></div></template><script>export default { data () { return{ cur:1 } },methods:{ }}</script><style scoped>.tab-content .active{ background-color: #194e84 !important; color: #fff; }.tab-content1{ text-align: center; cursor: pointer; width: 150px; height: 30px; border: 1px solid #ccc;}.tab-content2{ margin-top:-30px; text-align: center; cursor: pointer; margin-left:200px; width: 150px; height: 30px; border: 1px solid #ccc;}</style>

分割线-----一个简单的按钮切换就完成了,思路very简单,实现特别方便,也很好用哦: 是选中菜单时改变样式的代码哦

关于vue.js组件的教程,请大家点击专题vue.js组件学习教程进行学习。

更多vue学习教程请阅读专题《vue实战教程》

以上就是本文的全部内容,希望对大家的学习有所帮助,也希望大家多多支持好吧啦网。

标签: Vue
相关文章: