我试图隐藏并显示某些纸质材料,具体取决于termiantePlan
。正在从MVC 5视图传入terminatePlan
。一旦termiantePlan
命中控制语句,它就不能正确读取它...代码传递第一个if语句,因为termiantePlan
不为空。但是一旦它到达第二个if语句,它就会读取terminatePlan = "active"
。另外,如果termiantePlan == 'noPlan'
,我每次都会获得this.showTermPlanStatus(terminatedPlan)
。我也试过terminatePlan.indexOf('noPlan') > -1;
这也不起作用。
Polymer({
is: "lithium-terminate-plan",
properties: {
terminatePlan: String
},
observers: [
"termPlan(terminatePlan)"
],
termPlan: function (terminatePlan) {
if (terminatePlan != null || terminatePlan != "active") {
if (terminatePlan == "noPlan") {
this.showTermPlanStatus(noPlanSelected);
} else if (terminatePlan == "error") {
this.showTermPlanStatus(terminatedPlanError);
}
else {
this.showTermPlanStatus(terminatedPlan);
}
} else {
if (this.effectiveDate == null) {
} else {
this.showTermPlanStatus(activePlan);
}
}
},
showTermPlanStatus: function (showTrue) {
this.$.terminatePlanError.hidden = true;
this.$.terminatedPlan.hidden = true;
this.$.noPlanSelected.hidden = true;
this.$.activePlan.hidden = true;
this.$.terminatePlanInProcess.hidden = true;
showTrue.hidden = false;
}
});