To pass the data from the 'subDetail' object to 'form.acTaxPiIncomeReportingDetail' in Vue.js, you can modify the 'submitDetail()' method as follows:

submitDetail() {
  if (this.subDetail === null) {
    this.subDetail = {};
  }
  console.log(this.form1.acTaxPiIncomeReportingDetail, 'acTaxPiIncomeReportingDetail');
  this.isViewMode = false;
  this.$refs['form1'].validate((valid) => {
    if (valid) {
      // Other form validation and assignment operations
      // this.$refs.form1.validateField();
      this.form.acTaxPiIncomeReportingDetail = { ...this.subDetail };
      this.form.equityIncentiveIncome = this.calculateIncome();
      console.log(this.form.equityIncentiveIncome, 'form111');
      this.dialogVisible = false;
    } else {
      console.log('表单验证失败:', valid);
      console.log('error submit!!');
      return false;
    }
  });
},

By using the spread operator ({...this.subDetail}), you can create a new object with the same properties and values as 'subDetail' and assign it to 'form.acTaxPiIncomeReportingDetail'. This way, the data from 'subDetail' will be passed to 'form.acTaxPiIncomeReportingDetail' in the correct format.

Vue.js 中使用 spread 操作符传递数据

原文地址: http://www.cveoy.top/t/topic/peLb 著作权归作者所有。请勿转载和采集!

免费AI点我,无需注册和登录