子组件代码

// 子组件
validateForm() {
  return new Promise((resolve, reject) => {
    this.$refs.contractBaseRef.validate((valid) => {
      if (valid) {
        resolve(this.getFormData())
      } else {
        this.$message.error('请完成必填项输入!')
          resolve(false)
      }
  })
 })

子组件代码

// 父组件
<template>
  <contract-base-edit ref="outBaseInfoRef" />
</template>
<script>
// methods
this.$refs['outBaseInfoRef'].validateForm().then(res => {
  console.info('res out', res)
})
</script>

相关文章:

  • 2021-10-18
  • 2022-12-23
  • 2022-01-11
  • 2021-12-30
  • 2021-05-19
  • 2022-12-23
  • 2022-12-23
  • 2021-07-24
猜你喜欢
  • 2022-12-23
  • 2019-05-18
  • 2022-12-23
  • 2022-12-23
  • 2022-02-25
  • 2021-09-20
  • 2022-12-23
相关资源
相似解决方案