我是靠谱客的博主 感性可乐,这篇文章主要介绍element ui 按钮点击切换颜色,现在分享给大家,希望可以做个参考。

element ui 按钮点击切换颜色

**1.html **

复制代码
1
2
3
4
5
6
<el-button-group label="时间"> <el-button @click="seeHour" :type="buttonhour" >时</el-button> <el-button @click="seeDay" :type="buttonday" >天</el-button> <el-button @click="seeMonth" :type="buttonmonth" >月</el-button> </el-button-group>

2.数据

复制代码
1
2
3
4
5
6
7
8
data() { return { buttonhour:'primary', buttonday:'', buttonmonth:'', } }

3.方法

复制代码
1
2
3
4
5
6
7
8
9
10
11
12
13
14
15
16
17
18
19
20
21
22
23
24
25
seeHour() { this.showDay=false; this.showHour=true; this.showMonth=false; this.buttonhour='primary'; this.buttonday=''; this.buttonmonth=''; }, seeDay() { this.showDay=true; this.showHour=false; this.showMonth=false; this.buttonday='primary'; this.buttonhour=''; this.buttonmonth=''; }, seeMonth() { this.showDay=false; this.showHour=false; this.showMonth=true; this.buttonmonth='primary'; this.buttonday=''; this.buttonhour=''; }

实际只用两个的效果:在这里插入图片描述
在这里插入图片描述

最后

以上就是感性可乐最近收集整理的关于element ui 按钮点击切换颜色的全部内容,更多相关element内容请搜索靠谱客的其他文章。

本图文内容来源于网友提供,作为学习参考使用,或来自网络收集整理,版权属于原作者所有。
点赞(55)

评论列表共有 0 条评论

立即
投稿
返回
顶部