-
Notifications
You must be signed in to change notification settings - Fork 0
/
Copy pathej06.html
71 lines (50 loc) · 1.6 KB
/
ej06.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
48
49
50
51
52
53
54
55
56
57
58
59
60
61
62
63
64
65
66
67
68
69
70
71
<!DOCTYPE html>
<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>Ejemplo 5</title>
<script type="text/javascript" src="https://cdn.jsdelivr.net/npm/vue"></script>
<script type="text/javascript" src="https://cdnjs.cloudflare.com/ajax/libs/axios/0.18.0/axios.min.js"></script>
<!-- import CSS -->
<link rel="stylesheet" href="https://unpkg.com/element-ui/lib/theme-chalk/index.css">
<!-- import JavaScript -->
<script src="https://unpkg.com/element-ui/lib/index.js"></script>
</head>
<body>
<main>
<button @click="loadData()" >CARGAR</button>
<ol v-if="posts">
<li v-for="(post,idx) in posts">
{{post.title}}
</li>
</ol>
<span v-else>ESPERANDO DATOS</span>
{{$data}}
</main>
</body>
<script type="text/javascript">
new Vue({
el:'main',
data:{
posts:null
},
methods:{
loadData(){
axios.get("https://jsonplaceholder.typicode.com/posts")
.then((respuesta)=>{
this.posts=respuesta.data;
this.open11();
});
},
open11(){
this.$notify.success({
title: 'Success',
message: 'This is a success message',
offset: 100
});
}
}
});
</script>
</html>