2024-05-15 10:06:51 +08:00
|
|
|
|
<script lang="ts" setup>
|
2025-06-21 16:56:24 +08:00
|
|
|
|
import type { IFooItem } from '@/service/index/foo'
|
|
|
|
|
|
import { getFooAPI } from '@/service/index/foo'
|
2024-05-15 10:06:51 +08:00
|
|
|
|
|
|
|
|
|
|
const recommendUrl = ref('http://laf.run/signup?code=ohaOgIX')
|
|
|
|
|
|
|
2024-05-20 08:52:02 +08:00
|
|
|
|
// const initialData = {
|
|
|
|
|
|
// name: 'initialData',
|
|
|
|
|
|
// id: '1234',
|
|
|
|
|
|
// }
|
|
|
|
|
|
const initialData = undefined
|
|
|
|
|
|
const { loading, error, data, run } = useRequest<IFooItem>(() => getFooAPI('菲鸽'), {
|
2024-06-08 15:59:49 +08:00
|
|
|
|
immediate: true,
|
2024-05-20 08:52:02 +08:00
|
|
|
|
initialData,
|
|
|
|
|
|
})
|
2025-01-09 15:29:27 +08:00
|
|
|
|
|
2025-06-21 16:56:24 +08:00
|
|
|
|
function reset() {
|
2024-05-20 08:52:02 +08:00
|
|
|
|
data.value = initialData
|
2024-05-15 10:06:51 +08:00
|
|
|
|
}
|
|
|
|
|
|
</script>
|
2025-06-21 16:56:24 +08:00
|
|
|
|
|
|
|
|
|
|
<template>
|
|
|
|
|
|
<view class="p-6 text-center">
|
|
|
|
|
|
<view class="my-2">
|
|
|
|
|
|
使用的是 laf 云后台
|
|
|
|
|
|
</view>
|
|
|
|
|
|
<view class="text-green-400">
|
|
|
|
|
|
我的推荐码,可以获得佣金
|
|
|
|
|
|
</view>
|
|
|
|
|
|
|
|
|
|
|
|
<!-- #ifdef H5 -->
|
|
|
|
|
|
<view class="my-2">
|
|
|
|
|
|
<a class="my-2" :href="recommendUrl" target="_blank">{{ recommendUrl }}</a>
|
|
|
|
|
|
</view>
|
|
|
|
|
|
<!-- #endif -->
|
|
|
|
|
|
|
|
|
|
|
|
<!-- #ifndef H5 -->
|
|
|
|
|
|
<view class="my-2 text-left text-sm">
|
|
|
|
|
|
{{ recommendUrl }}
|
|
|
|
|
|
</view>
|
|
|
|
|
|
<!-- #endif -->
|
|
|
|
|
|
|
|
|
|
|
|
<!-- http://localhost:9000/#/pages/index/request -->
|
|
|
|
|
|
<wd-button class="my-6" @click="run">
|
|
|
|
|
|
发送请求
|
|
|
|
|
|
</wd-button>
|
|
|
|
|
|
<view class="h-16">
|
|
|
|
|
|
<view v-if="loading">
|
|
|
|
|
|
loading...
|
|
|
|
|
|
</view>
|
|
|
|
|
|
<block v-else>
|
|
|
|
|
|
<view class="text-xl">
|
|
|
|
|
|
请求数据如下
|
|
|
|
|
|
</view>
|
|
|
|
|
|
<view class="text-green leading-8">
|
|
|
|
|
|
{{ JSON.stringify(data) }}
|
|
|
|
|
|
</view>
|
|
|
|
|
|
</block>
|
|
|
|
|
|
</view>
|
|
|
|
|
|
<wd-button type="error" class="my-6" :disabled="!data" @click="reset">
|
|
|
|
|
|
重置数据
|
|
|
|
|
|
</wd-button>
|
|
|
|
|
|
</view>
|
|
|
|
|
|
</template>
|