rewrite the watcher to only watch the remainingFunds object
This commit is contained in:
parent
2a9a6a8907
commit
4576b66f67
|
@ -40,11 +40,14 @@ export default {
|
||||||
data.currentExpenses += enteredExpense.value;
|
data.currentExpenses += enteredExpense.value;
|
||||||
}
|
}
|
||||||
|
|
||||||
watch(data, function(_, newValue) {
|
watch(
|
||||||
if (newValue.remainingFunds < 0) {
|
() => data.remainingFunds,
|
||||||
alert('You are broke!');
|
function(_, newValue) {
|
||||||
|
if (newValue < 0) {
|
||||||
|
alert('You are broke!');
|
||||||
|
}
|
||||||
}
|
}
|
||||||
});
|
);
|
||||||
|
|
||||||
return {
|
return {
|
||||||
data,
|
data,
|
||||||
|
|
Reference in New Issue