iview render 单选框radio联动问题

1、iview table 中操作按钮用到modal,想要改变modal实现两个单选,并根据选择传不同的值给后台
代码:

<Table
        border
        ref="selection"
        :columns="tableColumns"
        :data="tableData"
      ></Table>
data:{
radioValue: "",
tableColumns: [
        {
          title: "标签名称",
          key: "labelName"
        },
        {
          title: "操作",
          fixed: "right",
          width: 200,
          align: "center",
          render: (h, params) => {
            return h("div", [
              h(
                "Button",
                {
                  props: {
                    type: "error",
                    size: "small"
                  },
                  style: {
                    marginRight: "5px",
                    display:
                      params.row.state != "已删除" ? "inline-block" : "none"
                  },
                  on: {
                    click: () => {
                      this.$Modal.confirm({
                        title: "确认删除",
                        render: h => {
                          return h(
                            "RadioGroup",
                            {
                              props: {
                                value: this.radioValue
                              },
                              on: {
                                "on-change": val => {
                                  this.radioValue = val;
                                }
                              }
                            },
                            [
                              h(
                                "Radio",
                                {
                                  props: {
                                    label: "1"
                                  },
                                  style: {
                                    marginRight: "5px"
                                  }
                                },
                                "仅删除标签"
                              ),
                              h(
                                "Radio",
                                {
                                  props: {
                                    label: "3"
                                  },
                                  style: {
                                    marginRight: "5px"
                                  }
                                },
                                " 删除标签并删除关联关系"
                              )
                            ]
                          );
                        },
                        onOk: () => {
                          this.delAction(params.row.labelId);
                        }
                      });
                    }
                  }
                },
                "删除"
              )
            ]);
          }
        }
      ],
      },
      methods:{
delAction(id) {
     
}

2、render函数渲染的单选框,第一次选择这一项,第二次出现的时候还会默认选中这一项,期待做成第一次选中之后第二次默认清空
在这里插入图片描述
在这一行( click: () => { )下面加一句this.radioValue=’'就可以了

评论 1
添加红包

请填写红包祝福语或标题

红包个数最小为10个

红包金额最低5元

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

抵扣说明:

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

余额充值