-
Notifications
You must be signed in to change notification settings - Fork 1
/
Copy pathadd.html
47 lines (38 loc) · 1.01 KB
/
add.html
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
<!DOCTYPE html>
<html>
<body>
<script src="https://unpkg.com/axios/dist/axios.min.js"></script>
<script src="https://cdn.jsdelivr.net/npm/vue@2"></script>
<div id="app">
<h1>Aggiungi un elemento</h1>
<label>name:</label>
<input type="text" v-model="name" placeholder="nome"><br><br>
<label>prezzo:</label>
<input type="text" v-model="prezzo" placeholder="prezzo"><br><br>
<button type="button" @click="loadDoc">Aggiungi</button>
<p>
<button type="button" onclick="window.location.href='/main';">indrio</button>
</p>
{{ res }}
</div>
<script>
let name = null
let prezzo = null
var app = new Vue({
el: '#app',
data: {
res: null
},
methods: {
loadDoc: async function () {
let response = await axios.post('/prodotto/create', {
name,
prezzo
})
this.res = response.data;
}
}
})
</script>
</body>
</html>