mirror of
https://github.com/chansee97/nova-admin.git
synced 2025-04-06 03:57:54 +08:00
33 lines
628 B
Vue
33 lines
628 B
Vue
<script setup lang="ts">
|
||
import { useRequest } from 'alova'
|
||
import {
|
||
fetchGet,
|
||
} from '@/service'
|
||
|
||
const emit = defineEmits<{
|
||
update: [data: any] // 具名元组语法
|
||
}>()
|
||
|
||
const { data: fetchGetData, send: sendFetchGet } = useRequest(fetchGet({ a: 112211 }), {
|
||
// 当immediate为false时,默认不发出
|
||
immediate: false,
|
||
})
|
||
|
||
async function handleRequestHook() {
|
||
await sendFetchGet()
|
||
emit('update', fetchGetData.value)
|
||
}
|
||
</script>
|
||
|
||
<template>
|
||
<n-card title="useRequest风格" size="small">
|
||
<n-button @click="handleRequestHook">
|
||
click
|
||
</n-button>
|
||
</n-card>
|
||
</template>
|
||
|
||
<style scoped>
|
||
|
||
</style>
|