zl程序教程

您现在的位置是:首页 >  大数据

当前栏目

表单失去焦点校验数据后,有问题的焦点激活

数据 表单 激活 校验 焦点 失去 问题
2023-09-11 14:17:22 时间
 <el-input
                  v-model="scope.row.setMaxScore"
                  :ref="`inputRefs${scope.$index}`"
                  size="small"
                  @blur="changeMax
                (scope.$index,scope.row)"

                ></el-input>
    //鼠标离开
    changeMax(index, row) {
      this.rowIndex = index;
     this.maxScore = row.setMaxScore;
      this.minScore = row.setMinScore;
      if(this.minScore!=''&&this.maxScore==''){
        return
      }
      else{
        if(Number(this.minScore) >=Number(this.maxScore)){
      this.$message.error('第'+(this.rowIndex+1)+'行最大值应该大于最小值')
      this.$refs[`inputRefs${index}`].focus()

//有的时候要加
[0]
this.$refs[`stepInputRefs${mindex}a${index}`][0].focus();
      }
      }

    },

 

export default {
  name: "SetGrade",
  components: {},
  
  directives: {
    focus: {
        // 指令的定义
        inserted: function(el){
            el.focus()
        }
    }
  },
}