-
Notifications
You must be signed in to change notification settings - Fork 1
/
Copy pathindex.html
76 lines (70 loc) · 3.13 KB
/
index.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
72
73
74
75
76
<html>
<head>
<title>My App</title>
</head>
<body>
<link rel="stylesheet" type="text/css" href="https://cdnjs.cloudflare.com/ajax/libs/bulma/0.7.5/css/bulma.min.css">
<h1>Hello World</h1>
<div id="zestyApp">
<div class="columns">
<div class="column">
<h2 class="title">{{ message }}</h2>
<h4 class="subtitle">{{ subtitle }}</h4>
<button @click="getPopStars()">Populate the Starz</button>
<ul v-if="popstars.length > 0">
<li v-for="popstar in popstars" v-bind:key="popstar.meta.zuid">
<h2>{{popstar.content.name}}</h2>
{{popstar.meta.type}}
<img :src="popstar.content.photo.data[0].url" width="400">
<hr>
</li>
</ul>
</div>
<div class="column">
<img :src="image" width="400">
<button @click="hello()" class="button">Click Me</button>
<button @click="randomImage()" class="button">Random Image</button>
</div>
</div>
</div>
<script src="https://cdn.jsdelivr.net/npm/vue/dist/vue.js"></script>
<script>
var app = new Vue({
el: '#zestyApp',
data: {
message: 'Hello Vue!',
subtitle: 'hey all there is more pizza',
image: "https://placeimg.com/640/480/any",
popstars: []
},
methods: {
hello: function () {
var endpoint = "https://h60nts24-dev.preview.zestyio.com/-/instant/7-e2cd9ffb9b-grzvkk.json"
var vm = this
fetch(endpoint).then(json => json.json()).then(json => {
vm.message = json.data[0].content.message
vm.subtitle = json.data[0].content.subtitle
vm.image = json.data[0].content.image.data[0].url
})
this.subtitle = 'Pizza is running out omg!'
setTimeout(function(){
this.subtitle = 'not its not, lawls!!!'
}.bind(this), 3000)
},
getPopStars: function(){
var endpoint = "https://h60nts24-dev.preview.zestyio.com/-/instant/6-98b2b08bdb-84gl5s.json"
fetch(endpoint).then(json => json.json()).then(json => {
this.popstars = json.data
})
},
randomImage: function() {
this.image = "https://placeimg.com/640/480/any"
}
},
created: function() {
this.hello()
}
})
</script>
</body>
</html>