如何在vue js中检查两个条件的同时性

how can check two condition simultaneity in vue js

我正在尝试检查请求中是否存在附件,附件字段是否存在于以模式显示消息的表单中,如果正文存在于请求中且富文本字段不存在于表单中则显示错误,

但在我的例子中,如果附件存在于请求中并且附件字段存在,它会继续并移动到 else,如果富文本字段不存在于表单中并且它不显示错误,因为它不执行 if 内的 if。我不知道如何检查这两个条件。

 if (this.selectedForm) {
    let attachmentField = this.selectedForm.formFields.filter(formField => {
      return formField.fieldAttributeType == 'attachment'
    })
    let descriptionField = this.selectedForm.formFields.filter(formField =>{
      return formField.fieldAttributeType == 'rich_text'
    })
    debugger
    if (this.request.attachments.length > 0 && attachmentField.length == 0) {
      debugger
      this.missingFields.push("Attachment field does't exist in custom form");
      if (this.request.bodyText.length > 0 && descriptionField.length == 0) {
        this.missingFields.push("and Rich_text field does't exist in custom form");
      }
      this.$refs.ticketCreationConfirmation.open();
    } else if (this.missingFields.length == 0){
      this.addRequest(this.request);     
    }
  }
if (this.selectedForm) {
    let attachmentField = this.selectedForm.formFields.filter(formField => {
        return formField.fieldAttributeType == 'attachment'
    })

    let descriptionField = this.selectedForm.formFields.filter(formField => {
        return formField.fieldAttributeType == 'rich_text'
    })

    if (this.request.attachments.length > 0 && attachmentField.length == 0) {
        this.missingFields.push("Attachment field doesn't exist in custom form");
    }

    if (this.request.bodyText.length > 0 && descriptionField.length == 0) {
        this.missingFields.push("Rich_text field doesn't exist in custom form");
    }

    if (this.missingFields.length > 0) {
        this.$refs.ticketCreationConfirmation.open();
    } else {
        this.addRequest(this.request);     
    }
  }

如果你想用"and"连接显示它们,你可以像这样连接错误信息:

this.missingFields.join(" and ");