-
Notifications
You must be signed in to change notification settings - Fork 0
/
Copy pathApp.vue
77 lines (71 loc) · 1.49 KB
/
App.vue
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
77
// App.vue
<template>
<div>
<div class="aaa">
<div class="container">
<router-link v-for="camera in cameras" :key="camera.key" :to="`/${camera.key}`">
{{ camera.name }}
</router-link>
</div>
</div>
<router-view></router-view>
</div>
</template>
<script lang="ts">
import Vue from "vue";
export default {
data() {
return {
cameras: [],
isLoading: true,
isError: false
};
},
async mounted () {
try {
this.isError = false;
this.isLoading = true;
let res = await fetch('/api/cameras')
this.cameras = await res.json();
console.log(this.cameras);
} catch (e) {
this.isError = true;
} finally {
this.isLoading = false;
}
// fetch()
// .get('https://api.coindesk.com/v1/bpi/currentprice.json')
// .then(response => {
// this.info = response.data.bpi
// })
// .catch(error => {
// console.log(error)
// this.errored = true
// })
// .finally(() => this.loading = false)
}
};
</script>
<style lang="scss" scoped>
.container {
margin-top: 10px;
padding-left: 10px;
flex: 0 0 auto;
}
.container a {
display: inline-block;
padding: 15px;
margin-right: 2px;
border-radius: 5px 5px 0 0;
border: 0px solid #334;
border-width: 1px 1px 0 1px;
border-collapse: collapse;
background: #334;
color: #bbb;
text-decoration: none;
}
.container a.router-link-active {
background: #223;
border-color: #223;
}
</style>