-
Notifications
You must be signed in to change notification settings - Fork 1
/
app.vue
53 lines (52 loc) · 1.23 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
<template>
<div>
<div>Post state: {{ resNewDataSuccess }}</div>
<input type="text" v-model="val">
<button @click="postData">Post data</button>
<div>Get Data: {{ resNewData }}</div>
<button @click="getData">Get data</button>
<ClientOnly placeholder-tag="span">
<template #fallback>
<div>
loading...123456
</div>
</template>
<div>Hi. Good morning.</div>
</ClientOnly>
<NuxtLayout>
<NuxtPage />
</NuxtLayout>
<nav>
<NuxtLink to="/">index</NuxtLink>
-----
<NuxtLink to="/sub/123">sub 123</NuxtLink>
</nav>
<!-- <div>{{ component }}</div> -->
</div>
</template>
<script setup lang="ts">
// import { getComponent } from './getComponent';
// let component = getComponent();
let resNewDataSuccess = ref()
let resNewData = ref()
let val = ref()
const postData = async () => {
const { data: resDataSuccess } = await useFetch(
'/api/test',
{
headers: {
Authorization: 'ffffffffff',
},
method: 'post',
body: {
text: val.value
}
}
)
resNewDataSuccess = resDataSuccess
}
const getData = async () => {
const { data: resData } = await useFetch('/api/test')
resNewData = resData
}
</script>