Skip to content

Commit 96029df

Browse files
author
Luiz Eduardo
committed
Uso de shortcut para v-bind e v-on
1 parent 9ef1e42 commit 96029df

File tree

2 files changed

+40
-0
lines changed

2 files changed

+40
-0
lines changed

html/exemplo7.html

Lines changed: 29 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -0,0 +1,29 @@
1+
<!DOCTYPE html>
2+
<html>
3+
<head>
4+
<meta charset="utf-8">
5+
<meta http-equiv="X-UA-Compatible" content="IE=edge">
6+
<title>VueJS</title>
7+
<link rel="stylesheet" href="">
8+
</head>
9+
<body>
10+
<div id="app">
11+
<!--
12+
Podemos substituir a diretiva "v-on:" por "@". Ambas as formas são
13+
interpretadas da mesma forma pelo VueJS. O "@" é apenas um atalho para
14+
o "v-on:".
15+
-->
16+
<button @click="changeLink">Click to change link</button>
17+
18+
<!--
19+
Podemos substituir a diretiva "v-bind" por ":". Ambas as formas são
20+
interpretadas da mesma forma pelo VueJS. O ":" é apenas um atalho para
21+
o "v-bind".
22+
-->
23+
<a :href="link">Link</a>
24+
</div>
25+
26+
<script src="../js/vue.js"></script>
27+
<script src="../js/exemplo7.js"></script>
28+
</body>
29+
</html>

js/exemplo7.js

Lines changed: 11 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -0,0 +1,11 @@
1+
new Vue({
2+
el: '#app',
3+
data:{
4+
link: 'http://google.com'
5+
},
6+
methods: {
7+
changeLink: function(){
8+
this.link = 'http://apple.com'
9+
}
10+
}
11+
});

0 commit comments

Comments
 (0)