vue render函数的写法(参考)

1:row(表格行), column(表格列), index(索引)

 {
         render(h, { row, column, index }) {
          let html = ''
          switch (row.state) {
            case 1:
              html = <Badge status="processing" text="排队中" />
              break
            case 2:
              html = <Badge status="success" text="已完成" />
              break
            case 3:
              html = <Badge status="error" text="自己撤单" />
              break
          }
          return html
        },
        // v-if的实现
        render(h, { row, column, index }) {
          let html = ''
          {
            row.state ? (html = <Badge status="success" text="正常" />) : (html = <Badge status="error" text="禁用" />)
          }
          return html
        },
      },
      // v-for的实现
       render() {
          const arr = [1, 2, 3, 4, 5, 6]
          const lis = arr.map((item, index) => <li key={index}>{item}</li>)
          return <ul>{lis}</ul>
        },

2:row(表格行), column(表格列), index(索引)

const that=this
 render(h, { row, column, index }) {
          const html = (
            <Tooltip placement="left">
              <a href="javascript:void(0)">更多</a>
              <div slot="content">
                {that.util.hasRole('getMemberUsingPOST_1') && (
                  <Row>
                    <Button type="info" size="small" onClick={() => that.detailHandle(row)}>
                      操作1
                    </Button>
                  </Row>
                )}
                {(that.util.hasRole('updatePwdUsingPOST') ||
                  that.util.hasRole('updatePayPwdUsingPOST') ||
                  that.util.hasRole('updateLevelUsingPOST')) && (
                  <Row class="margin-top-10">
                    <Button type="info" size="small" onClick={() => that.onReaetPwd(row)}>
                      操作2
                    </Button>
                  </Row>
                )}
                {that.util.hasRole('createUsingPOST_7') && (
                  <Row class="margin-top-10">
                    <Button type="error" size="small" onClick={() => that.onAddBlack(row)}>
                      操作3
                    </Button>
                  </Row>
                )}
                {that.util.hasRole('disabledUserUsingPOST') && row.state == 1 && (
                  <Row class="margin-top-10">
                    <Button type="error" size="small" onClick={() => that.onDisabledMember(row, 0)}>
                      操作4
                    </Button>
                  </Row>
                )}
                {that.util.hasRole('beLiftedUsingPOST') && !row.state && (
                  <Row class="margin-top-10">
                    <Button type="info" size="small" onClick={() => that.onDisabledMember(row, 1)}>
                      操作5
                    </Button>
                  </Row>
                )}
                {that.util.hasRole('getMemberAndGroupAwardUsingPOST') && (
                  <Row class="margin-top-10">
                    <Button type="info" size="small" onClick={() => that.onOrganization(row)}>
                      操作6
                    </Button>
                  </Row>
                )}
                {that.util.hasRole('registerUsingPOST_1') && (
                  <Row class="margin-top-10">
                    <Button type="info" size="small" onClick={() => that.registerModel(row)}>
                      操作7
                    </Button>
                  </Row>
                )}
                {that.util.hasRole('updateLevelUsingPOST') && (
                  <Row class="margin-top-10">
                    <Button type="info" size="small" onClick={() => that.updataLeave(row)}>
                      操作8
                    </Button>
                  </Row>
                )}
              </div>
            </Tooltip>
          )
          return html
        },
评论
添加红包

请填写红包祝福语或标题

红包个数最小为10个

红包金额最低5元

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

抵扣说明:

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

余额充值