1.html
<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.数据
data() { return { buttonhour:'primary', buttonday:'', buttonmonth:'', } }
3.方法
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=''; }
效果: