你可以尝试在handleVoucherGroup方法中先将voucherGroupId赋值给queryParams.voucherGroupId,然后再调用getList方法,示例代码如下:

handleVoucherGroup(voucherGroupId) {
  this.queryParams.voucherGroupId = voucherGroupId;
  this.getList();
  this.$refs.addvouchergroup.show();
}

这样子组件addVoucherGroups在接收到voucherGroupId时就不会是null了。

完整代码示例:

<template>
  <div>
    <el-button
      size="mini"
      type="text"
      @click="handleVoucherGroup(scope.row.voucherGroupId)"
    >
      添加凭证
    </el-button>
    <addVoucherGroups
      ref="addvouchergroup"
      :voucherGroupId="queryParams.voucherGroupId"
    ></addVoucherGroups>
  </div>
</template>

<script>
export default {
  data() {
    return {
      queryParams: {
        voucherGroupId: null
      }
    };
  },
  methods: {
    handleVoucherGroup(voucherGroupId) {
      this.queryParams.voucherGroupId = voucherGroupId;
      this.getList();
      this.$refs.addvouchergroup.show();
    },
    getList() {
      // 你的获取列表数据的逻辑
    }
  }
};
</script>

这样你就可以在子组件中获取到正确的voucherGroupId值了

新增凭证组 handleVoucherGroupvoucherGroupId this$refsaddvouchergroupshow; this$routerpushsettingfinancevoucherGroup ; thisqueryParamsvoucherGroupId = voucherGroupId; thisgetL

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

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