<el-radio-group v-model="uploadStatus" class="upload-status-radio"> <el-radio label="0" class="green" @click.native="clickRadio($event, 0)">成功</el-radio> <el-radio label="1" class="red" @click.native="clickRadio($event, 1)">失败</el-radio> </el-radio-group>
data () { return { uploadStatus: '-1' } }, methods: { /** * 点击单选框取消选中状态的处理 * @param e 原生e * @param index */ clickRadio (e, index) { if (e.target.tagName === 'INPUT') return // 因为原生click事件会执行两次,第一次在label标签上,第二次在input标签上,故此处理 if (this.uploadStatus === index.toString()) { this.uploadStatus = '-1' } }, }