feat(vue-query): 添加简单API调用示例并导入foo模块

在vue-query页面中添加直接调用API的示例代码,同时导入所需的foo模块
This commit is contained in:
feige996
2025-07-18 22:43:18 +08:00
parent cd640a9db2
commit a85630e686

View File

@@ -9,10 +9,16 @@
<script lang="ts" setup>
import { useQuery } from '@tanstack/vue-query'
import { foo } from '@/api/foo'
import { getFooQueryOptions } from '@/service/index/vue-query'
const initialData = undefined
// 简单使用
onShow(async () => {
const res = await foo()
console.log('res: ', res)
})
// vue-query 版
const {
data,
error,