vue3 reactive定义的变量,快速赋值对象里所有属性,且不丢调响应式

Object.assign(ruleForm, result)

let ruleForm = reactive({
      applicantName: '',
      applicantCorporation: '',
      applicantCorporationNumber: '',
      applicantCreditCode: '',
      applicantBusinessLicense: '',
      cashPoolId: '',
      totalAmount: 0,
      loanRateLimit: 80,
      interestMethod: '',
      dateTime: [],
      beginDate: '',
      endDate: '',
      interestRate: 0,
      chargesRate: 0,
      securityDepositRate: 0,
      overdueInterestRate: 0,
      gracePeriod: 0,
      bankInfoList: [],
      contractInfoList: []
    })
// 详情
    const getApplicantDetail = async () => {
      const params = {
        id: route.query.id
      }
      const { code, message, result } = await applicantDetail(params)
      if (code !== 200) return proxy.$message({ message: message, type: 'info' })
      Object.assign(ruleForm, result)
      ruleForm.dateTime = [ruleForm.beginDate, ruleForm.endDate]
    }

你可能感兴趣的:(vue3.0,前端)