Add API page and related routes
All checks were successful
CI / build-and-deploy (push) Successful in 5m58s

This commit is contained in:
严浩
2024-09-27 18:06:59 +08:00
parent 1380e280d4
commit 8143cf2e07
8 changed files with 382 additions and 5 deletions

25
src/pages/api.vue Normal file
View File

@ -0,0 +1,25 @@
<template>
<pre>{{ JSON.stringify(fakeApiResult, null, 2) }}</pre>
<!-- <div>{{ npmRegistryApiResult?.['_id'] }}</div> -->
</template>
<script setup lang="ts">
const baseURL = '/fake-api';
let fakeApiResult = $ref<Record<string, any> | null>(null);
fetch(`${baseURL}/mock/get-user-info`)
.then((response) => response.json())
.then((json) => (fakeApiResult = json));
/* fetch('https://jsonplaceholder.typicode.com/posts/1')
.then((response) => response.json())
.then((json) => console.log(json)); */
// let npmRegistryApiResult = $ref<Record<string, any> | null>(null);
// fetch('/npm-registry-api/@vue%2Fbabel-plugin-jsx')
// .then((response) => response.json())
// .then((json) => npmRegistryApiResult = json);
</script>
<style scoped></style>

View File

@ -25,11 +25,6 @@ const FComponent: FunctionalComponent<{ prop: string }> = (props, context) => (
</div>
</>
);
/* fetch('https://jsonplaceholder.typicode.com/posts/1')
.then((response) => response.json())
.then((json) => console.log(json)); */
fetch('/npm-registry-api/@vue%2Fbabel-plugin-jsx');
</script>
<template>
@ -39,6 +34,7 @@ fetch('/npm-registry-api/@vue%2Fbabel-plugin-jsx');
<li><router-link :to="{ name: 'TsEnumUtil' }">TS Enum Util</router-link></li>
<li><router-link :to="{ name: 'SomePage' }">Some Page</router-link></li>
<li><router-link :to="{ name: '中文页面' }">中文-页面.page.vue</router-link></li>
<li><router-link :to="{ name: 'Api' }">Api</router-link></li>
</ul>
<FComponent prop="Hello World" />
<div text-orange></div>