V3中使用JSX并且更换class类名

 表格


render:({ row }) => {
            const slots = {
              reference: () => <div style="cursor: pointer ;">{row.signDateTime} </div>,     //默认插槽
            }
            const iconSlot = {
              icon: () => 
              <div>              
                <div  vShow={row.color == '#0c9ee8'} class="lanse" style="width: 4px;height: 4px;border-radius: 50%"></div>
                <div  vShow={row.color == '#000000'} class="heise" style="width: 4px;height: 4px;border-radius: 50%"></div>
                <div  vShow={row.color == '#ff3737'} class="hongse" style="width: 4px;height: 4px;border-radius: 50%"></div>
                <div  vShow={row.color == '#ff902f'}  class="chengse" style="width: 4px;height: 4px;border-radius: 50%"></div>
                <div  vShow={row.color == '#a6a6a6'} class="huise" style="width: 4px;height: 4px;border-radius: 50%"></div>
              </div>
            }
            return <div vShow={state.searchData.signFlag != '0'}>   //一个判断条件
                <el-popover vSlots={slots} onBeforeEnter={ () => {showStep(row)}} effect="light" trigger="hover" placement="left" width={200} active={1}>
                  <el-steps class={getClass(row)} direction="vertical"  space={60} >
                    {
                      state.signLogData.map((item) => (
                          <el-step vSlots={iconSlot} title={item.status} description={item.gmtCreate}/>
                      ))
                    }
                  </el-steps>
                </el-popover>
            </div>
          }



//通过判断更换class类名
const getClass = (row) =>{
      switch (row.color){
        // 蓝色待诊
        case "#0c9ee8":
          return "lanse";
         // 黑色待诊
        case "#000000":
          return "heise";
           // 红色待诊
        case "#ff3737":
          return "hongse";
           // 橙色待诊
        case "#ff902f":
          return "chengse";
           // 灰色待诊
        case "#a6a6a6":
          return "huise";
      }
    }
<style lang="scss" scoped>
</style>

<style lang="scss">
/* 蓝色 */
.lanse .el-step__icon {
  border: none !important;
}
.lanse .is-process .lanse {
  border-color: #0c9ee8 !important;
}
.lanse .el-step__line {
  width: 0 !important;
  border-left:  1px dashed #dfdfdf !important;
}
.lanse .is-process {
  color: #0c9ee8;
}
.lanse .el-step__description {
  color: #5e5e5e;
  font-size: 16px;
}



/* 黑色 */
.heise .el-step__icon {
  border: none !important;
}
.heise .is-process .heise {
  border-color: #000000 !important;
}

.heise .el-step__line {
  width: 0 !important;
  border-left:  1px dashed #dfdfdf !important;
}
.heise .is-process {
  color: #000000;
}
.heise .el-step__description {
  color: #5e5e5e;
  font-size: 16px;
}



/* 红色 */
.hongse .el-step__icon {
  border: none !important;
}
.hongse .is-process .hongse {
  border-color: #ff3737 !important;
}
.hongse .el-step__line {
  width: 0 !important;
  border-left:  1px dashed #dfdfdf !important;
}
.hongse .is-process {
  color: #ff3737;
}
.hongse .el-step__description {
  color: #5e5e5e;
  font-size: 16px;
}



/* 橙色 */
.chengse .el-step__icon {
  border: none !important;
}
.chengse .is-process .chengse {
      border-color: #ff902f !important;
}
.chengse .el-step__line {
  width: 0 !important;
  border-left:  1px dashed #dfdfdf !important;
}
.chengse .is-process {
  color: #ff902f;
}
.chengse .el-step__description {
  color: #5e5e5e;
  font-size: 16px;
}



/* 灰色 */
.huise .el-step__icon {
  border: none !important;
}
.huise .is-process .huise {
      border-color: #a6a6a6 !important;
}
.huise .el-step__line {
  width: 0 !important;
  border-left:  1px dashed #dfdfdf !important;
}
.huise .is-process {
  color: #a6a6a6;
}
.huise .el-step__description {
  color: #5e5e5e;
  font-size: 16px;
}
</style>

  • 0
    点赞
  • 0
    收藏
    觉得还不错? 一键收藏
  • 1
    评论
评论 1
添加红包

请填写红包祝福语或标题

红包个数最小为10个

红包金额最低5元

当前余额3.43前往充值 >
需支付:10.00
成就一亿技术人!
领取后你会自动成为博主和红包主的粉丝 规则
hope_wisdom
发出的红包
实付
使用余额支付
点击重新获取
扫码支付
钱包余额 0

抵扣说明:

1.余额是钱包充值的虚拟货币,按照1:1的比例进行支付金额的抵扣。
2.余额无法直接购买下载,可以购买VIP、付费专栏及课程。

余额充值