0
  eSignAndRegistration: boolean;
  registration: boolean;
  esign: boolean;
  css: boolean;

  ngOnInit(): void {
    if (this.activatedRoute.snapshot.queryParamMap.has('registration')) {
      this.registration = true;
    } else if (this.activatedRoute.snapshot.queryParamMap.has('esign&registration')) {
      this.eSignAndRegistration = true;
    } else if (this.activatedRoute.snapshot.queryParamMap.has('esign')) {
      this.esign = true;
    } else if (this.activatedRoute.snapshot.queryParamMap.has('css')) {
      this.css = true;
    }
  }

为什么'&'符号会这样做?我怎样才能做到这一点,以便我可以使用 'esign®istration' 使布尔值 'eSignAndRegistration' 为真。

4

1 回答 1

0

我在 if 语句中添加了多个条件,它可以正常工作:

if (
  this.activatedRoute.snapshot.queryParamMap.has('esign') &&
  this.activatedRoute.snapshot.queryParamMap.has('registration')
) {
  this.eSignAndRegistration = true;
} else if (this.activatedRoute.snapshot.queryParamMap.has('registration')) {
  this.registration = true;
} else if (this.activatedRoute.snapshot.queryParamMap.has('esign')) {
  this.esign = true;
} else if (this.activatedRoute.snapshot.queryParamMap.has('css')) {
  this.css = true;
}
于 2021-07-14T15:32:19.727 回答