样式如图:"名家"默认被点击,这里给出艺术家类别的代码,英文类似。
<el-row :gutter="30" class="artistList" v-loading="loading">
<el-col :span="24">
<span class="colFont">艺术家类别: </span>
<el-button
v-for="(item, index) in categoryList"
:key="index"
:class="{'active': ind == index}"
@click="categoryStyle(index,item.id)"
type="text">{{item.title}}
</el-button>
</el-col>
</el-row>
data () {
return {
loading: false,
categoryList: ['名家', '媒体', '自媒体', '机构', '场务', '政务'],
ind: "",
}
},
methods: {
categoryStyle(index, id) {
this.ind = index;
}
}
.active {
background: rgba(230, 0, 18, 1);
color: #fff;
}