Files
vue-ts-example/src/pages/Tool/API/index.page.vue
严浩 31909c906d
All checks were successful
/ depcheck (push) Successful in 2m3s
/ build-and-deploy-to-vercel (push) Successful in 2m52s
/ lint-build-and-check (push) Successful in 2m57s
/ surge (push) Successful in 2m32s
/ playwright (push) Successful in 3m10s
feat: 添加 eslint-plugin-unicorn 依赖,更新 ESLint 配置以支持新规则
2025-03-14 12:50:54 +08:00

28 lines
799 B
Vue

<script setup lang="ts">
const baseURL = '/fake-api';
let fakeApiResult = $ref<null | Record<string, unknown>>(null);
onMounted(() => {
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>
<template>
<pre>{{ JSON.stringify(fakeApiResult, null, 2) }}</pre>
<!-- <div>{{ npmRegistryApiResult?.['_id'] }}</div> -->
</template>
<style scoped></style>