我需要在另一个具有更改值之后设置一个可观察值。例如:
我有这个:
Billing.FinishBillViewModel = function () {
this.billingId = ko.observable();
this.billingIva = ko.observable(0);
this.billingSubTotal = ko.observable(0);
this.billingTotal = ko.observable(0);
this.billingReceivedValue = ko.observable(0);
this.billingReturnedValue = ko.observable(0);
this.billingCode = ko.observable();
};
当this.billingReceivedValue
通过键盘设置值时,this.billingReturnedValue
上的算术运算必须是这个:
this.billingReturnedValue(this.billingReceivedValue() - this.billingTotal())
我尝试过计算和观察,并没有反映出我的观察结果的变化......
我怎么能这样做?