国产探花免费观看_亚洲丰满少妇自慰呻吟_97日韩有码在线_资源在线日韩欧美_一区二区精品毛片,辰东完美世界有声小说,欢乐颂第一季,yy玄幻小说排行榜完本

首頁 > 編程 > JavaScript > 正文

Vue實現導航欄點擊當前標簽變色功能

2019-11-19 11:27:23
字體:
來源:轉載
供稿:網友

本文實例為大家分享了Vue實現導航欄點擊當前標簽變色功能的具體代碼,供大家參考,具體內容如下

1.效果

2.所有代碼

<template> <div class="now-time"> <div class="timebox"> <a href="#" rel="external nofollow" 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>

以上就是本文的全部內容,希望對大家的學習有所幫助,也希望大家多多支持武林網。

發表評論 共有條評論
用戶名: 密碼:
驗證碼: 匿名發表
主站蜘蛛池模板: 巩留县| 商南县| 明水县| 靖边县| 姜堰市| 韶关市| 涪陵区| 宝鸡市| 崇阳县| 天津市| 册亨县| 阜宁县| 阳东县| 囊谦县| 搜索| 张家港市| 济阳县| 丰顺县| 宣威市| 本溪| 昌黎县| 偏关县| 庄浪县| 保山市| 武宣县| 新闻| 宜昌市| 苗栗县| 乌拉特后旗| 潜山县| 东乡县| 江口县| 阿荣旗| 安仁县| 河北区| 商南县| 广饶县| 万山特区| 南雄市| 屯门区| 东乡|