This article shares the specific code of vue+element-ui to implement the head navigation bar component for your reference. The specific content is as follows Without further ado, here's a rendering: This is a header navigation bar, the most common function on a website. Click the mouse to switch between different interfaces, and the style follows. npm install element-ui Import this UI framework globally in the main.js file Then register the top component in the app.vue file This is the head navigation bar implemented by vue and "hungry", take a look at the code: <template> <div class="header"> <div class="img"> <img src="@/assets/image/index/logo.png" alt=""> </div> <el-menu :default-active="this.$route.path" class="el-menu-demo" mode="horizontal" @select="handleSelect" router background-color="#fff" text-color="#333" active-text-color="#0084ff" style="flex:1" > <el-menu-item v-for="(item, i) in navList" :key="i" :index="item.name"> <template slot="title"> <span> {{ item.navItem }}</span> </template> </el-menu-item> </el-menu> </div> </template> <script> export default { data() { return { navList:[ {name:'/home', navItem:'Home'}, {name:'/home/classRoom',navItem:'My Class'}, {name:'/home/course',navItem:'My Course'}, {name:'/home/exam',navItem:'Create an exam'}, {name:'/home/practice',navItem:'Create a practice'}, ] } }, methods: { handleSelect(key, keyPath) { } } } </script> <style> .el-menu-item{ font-size: 18px !important; } .el-menu-item.is-active { color: #ea5b2c !important; font-size: 18px !important; } .el-menu--horizontal>.el-menu-item.is-active { border-bottom: 2px solid #ea5b2c !important; } </style> <style lang="scss" scoped> .header { display: flex; width: 100%; .img { background: #ffffff; border-bottom: solid 1px #e6e6e6; img { height:50px; padding:10px; } } } </style> My ability is limited, so if there are any shortcomings in my writing, I hope the experts passing by can give me some pointers. The above is the full content of this article. I hope it will be helpful for everyone’s study. I also hope that everyone will support 123WORDPRESS.COM. You may also be interested in:
|
<<: Detailed explanation of how to connect to MySQL database using Java in IntelliJ IDEA
>>: Solution to the error problem of Vscode remotely connecting to Ubuntu
Preface Some people have asked me some MySQL note...
This article shares the specific code of jQuery t...
Preface As you all know, we have encountered many...
Brief Description This is a CSS3 cool 3D cube pre...
Table of contents Previous words Synchronous and ...
Preface Dockerfile is a script interpreted by the...
vue+el-upload multiple files dynamic upload, for ...
Elasticsearch is very popular now, and many compa...
This article example shares the specific code for...
Zabbix automatically discovers rules to monitor s...
Table of contents Overview From Binary Tree to B+...
Table of contents 1. Eclipse configures Tomcat 2....
Floating ads are a very common form of advertisin...
<br />I have been working in front-end for s...
Table of contents 1. Follow the wizard to create ...