-
Notifications
You must be signed in to change notification settings - Fork 1
/
ej06.html
51 lines (49 loc) · 1.49 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
<!DOCTYPE html>
<html>
<head>
<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>
</html>
<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.open3();
});
},
open3() {
this.$notify({
title: 'Success',
message: 'This is a success message',
type: 'success'
});
}
}
});
</script>