-
Notifications
You must be signed in to change notification settings - Fork 0
/
Copy pathmetodosCompo.html
43 lines (37 loc) · 922 Bytes
/
metodosCompo.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
<!doctype html>
<html lang="en">
<head>
<!-- Required meta tags -->
<meta charset="utf-8">
<meta name="viewport" content="width=device-width, user-scalable=no, initial-scale=1, maximun-scale=1, minimun-scale=1">
<meta http-equiv="X-UA-Compatible" content="ie=edge">
<title>Métodos en componentes</title>
</head>
<body>
<main id="app">
<me-gusta></me-gusta>
</main>
<template id="meGusta">
<button @click="incremento">{{total}} Me gusta</button>
</template>
<script src="vueJS/vue.min.js"></script>
<script>
Vue.component('me-gusta',{
template: '#meGusta',
data: function(){
return{
total:0
}
},
methods:{
incremento:function(){
this.total += 1
}
}
})
const app = new Vue({
el:'#app'
})
</script>
</body>
</html>