ElementUI之单选框 el-radio 点击改变提交按钮状态功能

<template>
  <div>
    <el-radio-group v-model="radioTreaty" @change="agreeChange">
        <el-radio label="1" border>不同意</el-radio>
        <el-radio label="2" border>同意</el-radio>
    </el-radio-group>
    <el-button type="primary"  :disabled="btnstatus" style="width: 180px;">提交订单</el-button>
  </div>
</template>

<script>
  export default {
      data() {
          return {
            radioTreaty: '1',
            btnstatus:true,
          }
      },
      methods: {
          agreeChange:function(val){
            let that = this 
            that.btnstatus=(val==='1')?true:false;
          }
      }
  }
</script>

<style>
  .el-radio-group{
    display:block;
    margin-bottom:20px;
  }
</style>

 参考网址:https://blog.csdn.net/xfcy1990/article/details/90438549

猜你喜欢

转载自www.cnblogs.com/webBirdsFly/p/11535459.html