本文实例为大家分享了Vue+elementUI实现点击按钮互斥的具体代码,供大家参考,具体内容如下 先看看实现的效果吧! 步骤: 一.html代码 <!-- 等级筛选 --&
本文实例为大家分享了Vue+elementUI实现点击按钮互斥的具体代码,供大家参考,具体内容如下
先看看实现的效果吧!
一.html代码
<!-- 等级筛选 -->
<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: '铂金'
}
], // 等级筛选数据
itemType: 0, // 等级筛选选中的标识
materialCode: '' // 分类的code值
}
},
methods: {
// 等级筛选互斥效果
materTay(itemType, code) {
// 等级筛选选中的标识-高亮效果
this.itemType = itemType
// 分类的code值
this.materialCode = code
}
}
}
--结束END--
本文标题: vue+elementUI实现点击按钮互斥效果
本文链接: https://www.lsjlt.com/news/145728.html(转载时请注明来源链接)
有问题或投稿请发送至: 邮箱/279061341@qq.com QQ/279061341
下载Word文档到电脑,方便收藏和打印~
2024-01-12
2023-05-20
2023-05-20
2023-05-20
2023-05-20
2023-05-20
2023-05-20
2023-05-20
2023-05-20
2023-05-20
回答
回答
回答
回答
回答
回答
回答
回答
回答
回答
0