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

歡迎訪問 生活随笔!

生活随笔

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

vue

vue切换css样式

發布時間:2024/9/27 vue 26 豆豆
生活随笔 收集整理的這篇文章主要介紹了 vue切换css样式 小編覺得挺不錯的,現在分享給大家,幫大家做個參考.

vue通過點擊控制多個元素的css樣式

<div class="hide-class" v-for="(item,index) in list" :class="{'activeClass': rSelect.indexOf(item)!=-1}" @click="showdifference(item,index)" ><div class="class_triangle" :class="{'classtriangle': rSelect.indexOf(item)!=-1}"></div><img :src="item.big_pic_url" /><p>{{item.name}}</p> </div> <script>export default {data() {return {rSelect: [],};},methods: {showdifference(item,index) {if (this.rSelect.indexOf(item) !== -1) {this.rSelect.splice(this.rSelect.indexOf(item), 1); //取消} else {this.rSelect.push(item);//選中添加到數組里}console.log(this.rSelect);},}, } </script> <style> .hide-class{box-sizing: border-box;cursor: pointer;width: 109px;height: 109px;border-radius: 4px;border: 1px solid #E6E6E6;margin-right: 20px;margin-bottom: 20px;position: relative;.class_triangle {position: absolute;bottom: -6px;right: -6px;width: 0px;height: 0px;content: " ";border-right: 6px solid transparent;border-top: 6px solid transparent;border-left: 6px solid transparent;border-bottom: 6px solid transparent;transform: rotate(135deg);} .classtriangle {border-bottom: 6px solid #FF0E25; }img{width: 56px;height: 56px;margin: 12px auto 8px; } p{text-align: center; } } .activeClass {border: 1px solid #FF0E25; } </style>

總結

以上是生活随笔為你收集整理的vue切换css样式的全部內容,希望文章能夠幫你解決所遇到的問題。

如果覺得生活随笔網站內容還不錯,歡迎將生活随笔推薦給好友。