0
있는지 확인 나는 owner
과 tenant
이 사실이 두 속성 중 어느 것이 확인에 따라 this.productStatusReferences
에 문자열을 할당이 조건이 사실이다 owner
여부 tenant
자바 스크립트 - 속성의 값이 true와 리턴 문자열
if (this.projectCurrentProduct.occupancyType.owner) {
this.productStatusReferences = 'productStatusSale'
} else if (this.projectCurrentProduct.occupancyType.tenant) {
this.productStatusReferences = 'productStatusRent'
}
예를 들어 Lodash 또는 es2015와 동일한 작업을 수행하는보다 정교한 솔루션을 찾고 있습니까?
무엇을 묻고 있는지 확실하지 않습니다. 여기서 수정해야 할 부분이 많지 않습니다. 두 개의 if가 있기 때문에 삼항 항이 순서에 있지 않습니다. 스위치를 읽기가 더 쉬울 수 있습니다. – mplungjan
둘 다 아닌 경우 어떻게해야합니까? – Bergi
'this.projectCurrentProduct.occupancyType'에 대한 변수를 만들어야합니다. – Bergi