-
Notifications
You must be signed in to change notification settings - Fork 0
Expand file tree
/
Copy pathscript.js
More file actions
110 lines (101 loc) · 2.45 KB
/
script.js
File metadata and controls
110 lines (101 loc) · 2.45 KB
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
46
47
48
49
50
51
52
53
54
55
56
57
58
59
60
61
62
63
64
65
66
67
68
69
70
71
72
73
74
75
76
77
78
79
80
81
82
83
84
85
86
87
88
89
90
91
92
93
94
95
96
97
98
99
100
101
102
103
104
105
106
107
108
109
110
const vm = new Vue({
el: '#app',
data: {
inputPao: "",
inputMolhos: [],
inputSalada: [],
inputHamburguer: "",
etapa: 1,
inputNome:"",
inputEndereco:"",
novoPedidoAssincrono: null,
},
methods: {
fazerpedido(){
if(this.inputPao && this.inputHamburguer){
this.etapa = 2
}else {
alert("Você precisa selecionar um pão e um hambuguer!")
}
},
confirmarpedido(){
if(this.inputNome && this.inputEndereco){
this.etapa = 3
}else {alert('Preencha o nome e o endereço')
}
this.novoPedidoAssincrono = setTimeout(() => this.novoP(), 7000)
},
novoP(){
this.etapa = 1
this.inputPao = ""
this.inputMolhos = []
this.inputSalada = []
this.inputHamburguer = ""
this.inputNome= ""
this.inputEndereco = ""
}
},
computed: {
pao() {
switch(this.inputPao){
case "gergelim":
return ["./imagens/pao_gergelim_superior.png", "./imagens/pao_gergelim_inferior.png"]
break
case "australiano":
return ["./imagens/pao_australiano_superior.png", "./imagens/pao_australiano_inferior.png"]
break
default:
return ["./imagens/padrao/pao_superior.png", "./imagens/padrao/pao_inferior.png"]
}
},
alface(){
if(this.inputSalada.includes("alface")){
return "./imagens/alface.png"
} else{
return "./imagens/padrao/alface.png"
}
},
ketchup(){
if(this.inputMolhos.includes("ketchup")){
return "./imagens/ketchup.png"
}else{
return "./imagens/padrao/molho.png"
}
},
maionese(){
if(this.inputMolhos.includes("maionese")){
return "./imagens/maionese.png"
}else{
return "./imagens/padrao/molho.png"
}
},
mostarda(){
if(this.inputMolhos.includes("mostarda")){
return "./imagens/mostarda.png"
}else{
return "./imagens/padrao/molho.png"
}
},
hamburguer(){
switch(this.inputHamburguer){
case 'bovino':
return "./imagens/bovino.png"
break
case 'soja':
return "./imagens/soja.png"
break
case 'frango':
return "./imagens/frango.png"
default:
return "./imagens/padrao/hamburguer.png"
}
},
},
watch: {
etapa(novoValor) {
if(novoValor == 1) {
clearTimeout(this.novoPedidoAssincrono)
}
}
}
})