This repository was archived by the owner on Oct 21, 2020. It is now read-only.
forked from lorranpalmeira/VueJs
-
Notifications
You must be signed in to change notification settings - Fork 0
Expand file tree
/
Copy pathvue-filters.html
More file actions
58 lines (51 loc) · 1.35 KB
/
vue-filters.html
File metadata and controls
58 lines (51 loc) · 1.35 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
<!DOCTYPE html>
<html lang="en">
<head>
<meta charset="UTF-8">
<meta name="viewport" content="width=device-width, initial-scale=1.0">
<meta http-equiv="X-UA-Compatible" content="ie=edge">
<title>Document</title>
</head>
<body>
<div id="app">
<ul>
<li v-for="usuario in usuarios">{{usuario.nome | truncate('10') }}</li>
</ul>
<input type="button" value="click" @click.prevent.stop="enviar()" >
</div>
</body>
</html>
<script src="https://unpkg.com/vue"></script>
<script>
var app = new Vue({
el:"#app",
data:{
usuarios :[
{nome:'joao'},
{nome:'jose'},
{nome:'maria'},
{nome:'filpe'},
{nome:'ana'}
]
},
filters:{
toUpperCase(str,param1,param2){
console.log('param1',param1);
console.log('param2',param2);
return str.toUpperCase();
},
truncate(str, lenght){
var outout = str;
if(output.lenght > lenght){
str.substring(0,lenght) + '...';
}
return str.substring(0,lenght);
}
},
methods:{
enviar(){
alert('Enviado');
}
}
})
</script>