vue 项目中遇到的bug

76 阅读1分钟

1、add表单时候 单选框必须赋值初始化的 如果不赋值产生未知的错误,不报错就是 页面出错了 非常难排查

 this.ruleForm = {
        id: 0,
        radio: 1,
     }

2、edit表单时候 初始值有时候返回错误 检查初始类型,类型不一致会导致保存数据丢失

   handleEdit(row) {
      this.dialogFormVisible = true
      if (Array.isArray(row.training_comp)) {
        row.training_comp = {}
      }
      if (Array.isArray(row.driver_type_1)) {
        row.driver_type_1 = {}
      }
      if (Array.isArray(row.driver_type_8)) {
        row.driver_type_8 = {}
      }
      if (Array.isArray(row.driver_type_3)) {
        row.driver_type_3 = {}
      }
   }