Vue實現(xiàn)導航欄點擊當前標簽變色功能
更新時間:2020年08月19日 08:39:05 作者:小羽向前跑
這篇文章主要為大家詳細介紹了Vue實現(xiàn)導航欄點擊當前標簽變色功能,文中示例代碼介紹的非常詳細,具有一定的參考價值,感興趣的小伙伴們可以參考一下
本文實例為大家分享了Vue實現(xiàn)導航欄點擊當前標簽變色功能的具體代碼,供大家參考,具體內(nèi)容如下
1.效果
2.所有代碼
<template> <div class="now-time"> <div class="timebox"> <a href="#" v-for="(item,index) in nowTime" v-on:click="addClass(index)" v-bind:class="{ bgColors:index==current}"> <p>{{item.time}}</p> <p>{{item.start}}</p> </a> </div> </div> </template> <script> export default { name: "Nowtime", methods: { addClass:function(index){ this.current=index; } }, mounted() { }, data(){ return{ current:0, nowTime:[ { time:"9:00", start:"已開搶" }, { time:"10:00", start:"已開搶" }, { time:"11:00", start:"已開搶" }, { time:"12:00", start:"已開搶" }, { time:"13:00", start:"未開搶" }, { time:"14:00", start:"未開搶" }, { time:"15:00", start:"未開搶" }, ], } } } </script> <style scoped> .now-time{ width: 100%; height: .8rem; background: #282832; display: flex; overflow-x:scroll; } .timebox{ width: 100%; height: .8rem; display: flex; background: #282832; } .now-time a{ display: flex; flex-direction: column; width: 1.35rem; height: .79rem; align-items: center; flex-shrink: 0; } .now-time a p:first-child{ font-size: .23rem; color: white; font-weight: bold; } .now-time a p:last-child{ font-size: .16rem; color: white; } .timebox .bgColors{ background: #ff5700; } </style>
以上就是本文的全部內(nèi)容,希望對大家的學習有所幫助,也希望大家多多支持腳本之家。
相關文章
詳解element-ui表格的合并行和列(非常細節(jié))
最近在需求中遇到了elementUI合并行,索性給大家整理下,這篇文章主要給大家介紹了關于element-ui表格的合并行和列的相關資料,文中通過實例代碼介紹的非常詳細,需要的朋友可以參考下2023-06-06vue使用lottie-web實現(xiàn)web動畫效果
在web端,lottie-web庫可以解析導出的動畫json文件,并將其以svg或者canvas的方式將動畫繪制在我們的頁面上,這篇文章主要介紹了vue使用lottie-web實現(xiàn)web動畫,需要的朋友可以參考下2024-06-06Vue實現(xiàn)手機號、驗證碼登錄(60s禁用倒計時)
這篇文章主要介紹了Vue實現(xiàn)手機號、驗證碼登錄(60s禁用倒計時),幫助大家更好的理解和使用vue,感興趣的朋友可以了解下2020-12-12vue+three.js實現(xiàn)炫酷的3D登陸頁面示例詳解
這篇文章主要為大家介紹了vue+three.js實現(xiàn)炫酷的3D登陸頁面示例詳解,有需要的朋友可以借鑒參考下,希望能夠有所幫助,祝大家多多進步,早日升職加薪2022-07-07