forked from tushargugnani/learningVueJS
-
Notifications
You must be signed in to change notification settings - Fork 0
/
Copy path7. methods.html
33 lines (33 loc) · 919 Bytes
/
7. methods.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
<!DOCTYPE html>
<html lang="en">
<head>
<meta charset="UTF-8">
<meta name="viewport" content="width=device-width, initial-scale=1.0">
<title>Document</title>
<!-- development version, includes helpful console warnings -->
<script src="https://cdn.jsdelivr.net/npm/vue/dist/vue.js"></script>
</head>
<body>
<div id="app">
<h2>Greet</h2>
<button v-on:click="greet('Hello')">Say Hello</button>
<button v-on:click="greet('Hi')">Say Hi</button>
<button v-on:click="greet('Namaste')">Say Namaste</button>
<br/><br/>
{{greeting}}
</div>
</body>
<script type="text/javascript">
var app = new Vue({
el: '#app',
data: {
greeting: '',
},
methods: {
greet: function(greeting){
this.greeting = greeting + ", How Are You?";
}
}
});
</script>
</html>