-
Notifications
You must be signed in to change notification settings - Fork 0
/
Copy pathapp.vue
59 lines (51 loc) · 991 Bytes
/
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
<template>
<div class="container">
<h1>Your IP Address</h1>
<p v-if="ip">{{ ip }}</p>
<p v-else>Loading...</p>
</div>
<div id="app">
<NuxtPage />
<div class="build-version">
Build Version: {{ buildVersion }}
</div>
</div>
</template>
<script setup>
import { ref, onMounted } from "vue";
const ip = ref(null);
onMounted(async () => {
try {
const res = await fetch("/json");
const data = await res.json();
ip.value = data.ip;
} catch (error) {
console.error("Failed to fetch IP:", error);
}
});
const buildVersion = useRuntimeConfig().public.buildVersion;
</script>
<style>
.container {
display: flex;
flex-direction: column;
justify-content: center;
align-items: center;
min-height: 100vh;
font-family: Arial, sans-serif;
}
.build-version {
position: fixed;
bottom: 10px;
right: 10px;
font-size: 12px;
color: #aaa;
}
h1 {
font-size: 2rem;
margin-bottom: 1rem;
}
p {
font-size: 1.5rem;
}
</style>