当前位置: 首页 > 工具软件 > msgBox > 使用案例 >

eleme $msgbox 使用 单选框

司马彬
2023-12-01

话不多说直接上代码

      const h = this.$createElement;
      this.$msgbox({
        title: '消息',
        message: h('div', {key: "1"}, [
          this.read_card.readCardStatus,
          h('div', {
              style: {
                marginTop: '10px',
                marginBottom: '5px',
              }
            },
            [h('input', {
              style: {
                cursor: 'pointer',
              },
              attrs: {
                type: "radio",
                name: "chooseRadio",
                value: "1",
                checked: this.read_card.readCardStatus === '1',
              },
              on: {
                change: () => {
                  this.read_card.readCardStatus = '1'
                }
              }
            }, []), h('span', {
              class: 'el-radio__label'
            }, `强制读取`)]),

          h('div', null,
            [h('input', {
              style: {
                cursor: 'pointer',
              },
              attrs: {
                type: "radio",
                name: "chooseRadio",
                value: "0",
                checked: this.read_card.readCardStatus === '0',
              },
              on: {
                change: () => {
                  this.read_card.readCardStatus = '0'
                }
              }
            }, []), h('span', {class: 'el-radio__label'}, `普通读取`)]),
        ]),
        showCancelButton: true,
        confirmButtonText: '确定',
        cancelButtonText: '取消',
        beforeClose: (action, instance, done) => {
          if (action === 'confirm') {
            instance.confirmButtonLoading = true;
            instance.confirmButtonText = '执行中...';
            setTimeout(() => {
              done();
              setTimeout(() => {
                instance.confirmButtonLoading = false;
              }, 300);
            }, 3000);
          } else {
            console.log("取消")
            done();
          }
        }
      }).then(action => {
        this.$message({
          type: 'info',
          message: 'action: ' + action
        });
      }).catch(e => {
        console.log(e, "111111111111111111")
      });


来自大哥的抄写

 类似资料: