vue+elementUI實(shí)現(xiàn)點(diǎn)擊按鈕互斥效果
本文實(shí)例為大家分享了vue+elementUI實(shí)現(xiàn)點(diǎn)擊按鈕互斥的具體代碼,供大家參考,具體內(nèi)容如下
先看看實(shí)現(xiàn)的效果吧!
步驟:
一.html代碼
<!-- 等級(jí)篩選 --> ? ? <div class="level-screening"> ? ? ? <el-button ? ? ? ? size="medium" ? ? ? ? type="primary" ? ? ? ? :class="index==itemType?'highlight':''" ? ? ? ? v-for="(item,index) in levelList" ? ? ? ? :key="index" ? ? ? ? @click.prevent="materTay(index,item.code)" ? ? ? > ? ? ? ? {{ item.codeValue }}</el-button ? ? ? > </div>
二.css(less)代碼
.level-screening { ? ? ? padding-left: 40px; ? ? ? box-sizing: border-box; ? ? ? height: 120px; ? ? ? text-align: left; ? ? ? line-height: 80px; ? ? ? .el-button { ? ? ? ? border-color: #0085f4; ? ? ? ? background-color: #fff; ? ? ? ? color: #0085f4; ? ? ? } ? ? ? .highlight { ? ? ? ? background-color: #8e66f6 !important; ? ? ? ? color: #fff; ? ? ? } ? ? }
三.js代碼
export default { ?data() { ? ? return { ? ? ? ?levelList: [ ? ? ? ? { ? ? ? ? ? code: '', ? ? ? ? ? codeValue: '全部' ? ? ? ? }, ? ? ? ? { ? ? ? ? ? code: '', ? ? ? ? ? codeValue: '銅' ? ? ? ? }, ? ? ? ? { ? ? ? ? ? code: '', ? ? ? ? ? codeValue: '銀' ? ? ? ? }, ? ? ? ? { ? ? ? ? ? code: '', ? ? ? ? ? codeValue: '金' ? ? ? ? }, ? ? ? ? { ? ? ? ? ? code: '', ? ? ? ? ? codeValue: '白金' ? ? ? ? }, ? ? ? ? { ? ? ? ? ? code: '', ? ? ? ? ? codeValue: '鉑金' ? ? ? ? } ? ? ? ], // 等級(jí)篩選數(shù)據(jù) ? ? ? itemType: 0, // 等級(jí)篩選選中的標(biāo)識(shí) ? ? ? materialCode: '' // 分類的code值 ? ? ? ? } ? ? }, ? ?methods: { ? ? // 等級(jí)篩選互斥效果 ? ? materTay(itemType, code) { ? ? ? // 等級(jí)篩選選中的標(biāo)識(shí)-高亮效果 ? ? ? this.itemType = itemType ? ? ? // 分類的code值 ? ? ? this.materialCode = code ? ? } ? } }
以上就是本文的全部?jī)?nèi)容,希望對(duì)大家的學(xué)習(xí)有所幫助,也希望大家多多支持腳本之家。
相關(guān)文章
element中el-table與el-form同用并校驗(yàn)
本文主要介紹了element中el-table與el-form同用并校驗(yàn),文中通過示例代碼介紹的非常詳細(xì),對(duì)大家的學(xué)習(xí)或者工作具有一定的參考學(xué)習(xí)價(jià)值,需要的朋友們下面隨著小編來一起學(xué)習(xí)學(xué)習(xí)吧2022-08-08給vue項(xiàng)目添加ESLint的詳細(xì)步驟
本篇文章主要介紹了給vue項(xiàng)目添加ESLint的詳細(xì)步驟,小編覺得挺不錯(cuò)的,現(xiàn)在分享給大家,也給大家做個(gè)參考。一起跟隨小編過來看看吧2017-09-09vue實(shí)現(xiàn)同一個(gè)頁面可以有多個(gè)router-view的方法
今天小編就為大家分享一篇vue實(shí)現(xiàn)同一個(gè)頁面可以有多個(gè)router-view的方法,具有很好的參考價(jià)值,希望對(duì)大家有所幫助。一起跟隨小編過來看看吧2018-09-09Vuex的基本概念、項(xiàng)目搭建以及入坑點(diǎn)
Vuex是一個(gè)專門為Vue.js應(yīng)用程序開發(fā)的狀態(tài)管理模式,這篇文章主要介紹了Vuex的基本概念、項(xiàng)目搭建以及入坑點(diǎn),具有一定的參考價(jià)值,感興趣的小伙伴們可以參考一下2018-11-11vue.js單頁面應(yīng)用實(shí)例的簡(jiǎn)單實(shí)現(xiàn)
本篇文章主要介紹了vue.js單頁面應(yīng)用實(shí)例的簡(jiǎn)單實(shí)現(xiàn),使用單頁應(yīng)用,沒有頁面切換,就沒有白屏阻塞,可以大大提高 H5 的性能,達(dá)到接近原生的流暢體驗(yàn)。2017-04-04