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='';
   }

  效果:

 

转载于:https://www.cnblogs.com/guangzhou11/p/9934881.html

GitHub 加速计划 / eleme / element
54.06 K
14.63 K
下载
A Vue.js 2.0 UI Toolkit for Web
最近提交(Master分支:3 个月前 )
c345bb45 7 个月前
a07f3a59 * Update transition.md * Update table.md * Update transition.md * Update table.md * Update transition.md * Update table.md * Update table.md * Update transition.md * Update popover.md 7 个月前
Logo

旨在为数千万中国开发者提供一个无缝且高效的云端环境,以支持学习、使用和贡献开源项目。

更多推荐