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
Table of contents Canvas related documents Effect...
The execution efficiency of MySQL database has a ...
<br />Without any warning, I saw news on cnB...
ins and del were introduced in HTML 4.0 to help au...
First, understand a method: Entering a Docker con...
I have always wanted to learn about caching. Afte...
Last time we talked about some SQL query optimiza...
First of all, we need to understand that GB2312, ...
Tips for viewing History records and adding times...
The default submission method of html is get inste...
Today I was browsing the blog site - shoptalkshow...
Table of contents Functional Components How to wr...
Table of contents First Look Index The concept of...
Database application is an indispensable part of ...
When writing HTML code, the first line should be ...