完善服务端接口调用测试用例

This commit is contained in:
yuguo138
2023-02-24 12:20:56 +08:00
parent 73e35aa066
commit 992e1518bd
3 changed files with 35 additions and 2 deletions

View File

@@ -1,5 +1,14 @@
<template> <template>
<div> <div>
Home <a-button @click="onClick">Home</a-button>
{{ test }}
</div> </div>
</template> </template>
<script setup>
const { data: test } = await useFetch('/api/test');
const onClick=async function(){
console.log(1);
}
</script>

7
plugins/antd.ts Normal file
View File

@@ -0,0 +1,7 @@
import Antd from 'ant-design-vue';
// import { Button } from 'ant-design-vue';
// import Button from 'ant-design-vue/lib/button'
export default defineNuxtPlugin((nuxtApp)=>{
nuxtApp.vueApp.use(Antd);
})

17
server/api/test.js Normal file
View File

@@ -0,0 +1,17 @@
export default defineEventHandler(() => {
return {
title: 'Mount Everest',
description: "Mount Everest is Earth's highest mountain above sea level, located in the Mahalangur Himal sub-range of the Himalayas. The ChinaNepal border runs across its summit point",
height: '8,848 m',
countries: [
'China',
'Nepal'
],
continent: 'Asia',
image: 'https://upload.wikimedia.org/wikipedia/commons/thumb/f/f6/Everest_kalapatthar.jpg/600px-Everest_kalapatthar.jpg',
dir: '/mountains',
path: '/mountains/mount-everest',
slug: 'mount-everest',
updatedAt: '2020-12-11T15:40:35.000Z'
}
})