-
Notifications
You must be signed in to change notification settings - Fork 0
/
sc.txt
executable file
·45 lines (40 loc) · 1.24 KB
/
sc.txt
1
2
3
4
5
6
7
8
9
10
11
12
13
14
15
16
17
18
19
20
21
22
23
24
25
26
27
28
29
30
31
32
33
34
35
36
37
38
39
40
41
42
43
44
45
f(this.namaBelanjaan == '' || this.jumlah == '' || this.jumlah <= 0 || this.satuan == '' || this.hargaSatuan == ''){
this.validasiNama = true;
this.validasiJumlah = true;
this.validasiSatuan = true;
this.validasiHarga = true;
}else{
const newBelanjaan = {
id: this.data_belanja.length + 1,
nama_belanjaan: this.namaBelanjaan,
jumlah: this.jumlah,
satuan: this.satuan,
harga_satuan: this.hargaSatuan
};
// Kirim ke App.vue
this.$emit("tambah-belanjaan", newBelanjaan);
this.namaBelanjaan = "";
this.jumlah = "";
this.satuan = "";
this.hargaSatuan = "";
this.validasi = false;
}
namaBelanjaan: function(){
if(this.namaBelanjaan != ''){
this.validasiNama = false;
}
},
jumlah: function(){
if(this.jumlah <= 0){
this.validasiJumlah = true;
}else if(this.jumlah != ''){
this.validasiJumlah = false;
}
},
hargaSatuan: function(){
if(this.hargaSatuan <= 0){
return this.validasi = true;
}else if(this.hargaSatuan != ''){
return this.validasi = false;
}
}