您好,登錄后才能下訂單哦!
本文實例為大家分享了vue點擊當(dāng)前路由高亮的具體代碼,供大家參考,具體內(nèi)容如下
功能展示:
組件代碼:
標(biāo)簽上加exact
.router-link-active{ background: rgba(255,255,255,0.8); color: gray; }
<template> <nav> <ul> <li> <router-link to="/" exact>博客</router-link> <router-link to="/AddBlog" exact>寫博客</router-link> </li> </ul> </nav> </template> <script> export default { name: "bolgheader" } </script> <style scoped> ul{ list-style-type: none; text-align: center; margin:0; } li{ display: inline-block; margin:0 10px; } a{ color:rgb(102, 119, 204); text-decoration: none; padding:12px; border-radius: 5px; font-size:20px; } nav{ background: #eee; padding: 30px 0; margin-bottom: 40px; } .router-link-active{ background: rgba(255,255,255,0.8); color: gray; } </style>
以上就是本文的全部內(nèi)容,希望對大家的學(xué)習(xí)有所幫助,也希望大家多多支持億速云。
免責(zé)聲明:本站發(fā)布的內(nèi)容(圖片、視頻和文字)以原創(chuàng)、轉(zhuǎn)載和分享為主,文章觀點不代表本網(wǎng)站立場,如果涉及侵權(quán)請聯(lián)系站長郵箱:is@yisu.com進(jìn)行舉報,并提供相關(guān)證據(jù),一經(jīng)查實,將立刻刪除涉嫌侵權(quán)內(nèi)容。