unibest/src/pages/demo/base/request.vue

27 lines
531 B
Vue
Raw Normal View History

2024-01-09 09:34:45 +08:00
<route lang="json5">
{
layout: 'demo',
2024-01-09 09:34:45 +08:00
style: { navigationBarTitleText: 'request请求+请求拦截' },
}
</route>
2024-01-08 21:24:39 +08:00
<template>
<view>
<button @click="handleRequest" type="primary" class="w-20">请求</button>
<view class="mt-4">{{ result }}</view>
2024-01-08 21:24:39 +08:00
</view>
</template>
<script lang="ts" setup>
import { http } from '@/utils/http'
const result = ref()
const handleRequest = async () => {
const res = await http<string>({
url: '/foo',
2024-01-08 21:24:39 +08:00
method: 'GET',
})
console.log(res)
result.value = res
2024-01-08 21:24:39 +08:00
}
</script>