日韩性视频-久久久蜜桃-www中文字幕-在线中文字幕av-亚洲欧美一区二区三区四区-撸久久-香蕉视频一区-久久无码精品丰满人妻-国产高潮av-激情福利社-日韩av网址大全-国产精品久久999-日本五十路在线-性欧美在线-久久99精品波多结衣一区-男女午夜免费视频-黑人极品ⅴideos精品欧美棵-人人妻人人澡人人爽精品欧美一区-日韩一区在线看-欧美a级在线免费观看

歡迎訪問 生活随笔!

生活随笔

當前位置: 首頁 > 前端技术 > vue >内容正文

vue

vue升序降序按钮功能实现

發(fā)布時間:2024/3/26 vue 37 豆豆
生活随笔 收集整理的這篇文章主要介紹了 vue升序降序按钮功能实现 小編覺得挺不錯的,現(xiàn)在分享給大家,幫大家做個參考.

需求:默認升序,懸浮按鈕變色,點擊按鈕下標跟隨變化。

?

html

<div class="right"@click="change(item,index)"v-for="(item, index) in btnList":key="index">{{item.lable}}<div class="box-icon"><div class="up":class="item.status === 1 ? 'opacity-5' : ''"></div><div class="down":class="item.status === 1 ? 'opacity-1' : ''"></div></div></div>

js

data(){return{btnList: [{ lable: "更新時間", status: 0 },{ lable: "訪問量", status: 0 },{ lable: "申請量", status: 0 },],} }, methods:{change(item, index) {this.btnList[index].status === 0? (this.btnList[index].status = 1): (this.btnList[index].status = 0);} }

css

.right {padding: 0 20px;height: 32px;color: #505363;font-weight: 400;font-size: 14px;margin-left: 10px;border: 1px solid rgb(233, 231, 231);display: flex;justify-content: center;line-height: 32px;cursor: pointer;}.right:hover {color: #217aff;border: 1px solid #217aff;.up {border-bottom: 6px solid #217aff;}.down {border-top: 6px solid #217aff;}}.opacity-5 {opacity: 0.5;}.opacity-1 {opacity: 1 !important;}.box-icon {height: 30px;margin-top: 7px;.up {width: 0px; /*設置寬高為0,所以div的內(nèi)容為空,從才能形成三角形尖角*/height: 0px;border-bottom: 6px solid #a3a5b3;border-left: 4px solid transparent; /*transparent 表示透明*/border-right: 4px solid transparent;margin-bottom: 4px;}.down {width: 0px;height: 0px;opacity: 0.5;border-top: 6px solid #a3a5b3;border-left: 4px solid transparent;border-right: 4px solid transparent;}}.box-icon div {height: 10px;margin-left: 4px;}

總結(jié)

以上是生活随笔為你收集整理的vue升序降序按钮功能实现的全部內(nèi)容,希望文章能夠幫你解決所遇到的問題。

如果覺得生活随笔網(wǎng)站內(nèi)容還不錯,歡迎將生活随笔推薦給好友。