# @alitajs/vue-request

> @alitajs/vue-request

Latest version **0.0.8** (published 2023-04-25) · MIT license · 0 weekly downloads

## Install

```sh
npm install @alitajs/vue-request
pnpm add @alitajs/vue-request
yarn add @alitajs/vue-request
bun add @alitajs/vue-request
```

## Health

**Score 20/100 (F)** — status: abandoned.

Positive: has types; no vulnerabilities.

Warnings: low downloads; no esm support; pre 1.0.

Negative: abandoned; low maintenance score.

## Facts

| | |
|---|---|
| Version | 0.0.8 |
| Published | 2023-04-25 |
| First published | 2023-04-10 |
| Weekly downloads | 0 |
| License | MIT |
| TypeScript types | bundled |
| Module format | CommonJS |
| Dependencies | 3 |
| Unpacked size | 5.4 KB |
| Known vulnerabilities | 0 |
| Install scripts | no |
| GitHub stars | 8 |
| Maintainers | pengyh, ashoka_j, diyc, xiaohuoni, imhele, wangxingkang, shawdanon, cjy0208, sorrycc, hang1017, hammersjs |

## Links

- npm: https://www.npmjs.com/package/@alitajs/vue-request
- Repository: https://github.com/alitajs/valita
- Homepage: https://github.com/alitajs/valita/tree/master/packages/request#readme
- Issues: https://github.com/alitajs/valita/issues
- npm.io page: https://npm.io/package/@alitajs/vue-request

## Dependencies (3)

- [ahooks-vue](https://npm.io/package/ahooks-vue.md) ^0.15.0
- [@alita/request](https://npm.io/package/@alita/request.md) ^3.1.1
- [@alitajs/vue-utils](https://npm.io/package/@alitajs/vue-utils.md) ^0.0.8

## Recent versions

- 0.0.8 (latest) — 2023-04-25
- 0.0.7 — 2023-04-24
- 0.0.6 — 2023-04-17
- 0.0.5 — 2023-04-10

## README

# @alitajs/vue-request

定义 services

```ts
import { request } from 'valita';

export async function query(prames): Promise<any> {
  console.log(prames);
  return request('/hello');
}
```

```vue
<script setup>
import { useRequest , request } from 'valita';
import { query } from './services';
const { data, error, loading } = useRequest(query);
</script>

<template>
  <h1>Hi!</h1>
  <div v-if="loading">Loading</div>
  <div v-else>Hello {{ data.text }}</div>
</template>
```

> 感觉 import { useAsyncState } from '@vueuse/core'; 的用法更 vue ？

---
_Source: https://npm.io/package/@alitajs/vue-request · Machine-readable twin of the npm.io package page. Health data is recomputed on every publish._
