Ecosyste.ms: Awesome

An open API service indexing awesome lists of open source software.

Awesome Lists | Featured Topics | Projects

https://github.com/roshan-labs/http-module

🔀 Request module for Nuxt
https://github.com/roshan-labs/http-module

fetch nuxt-module nuxt3

Last synced: about 2 months ago
JSON representation

🔀 Request module for Nuxt

Awesome Lists containing this project

README

        

# @roshan-labs/http-module

封装 nuxt `$fetch` 方法,统一配置 `baseURL`

## 安装

```bash
yarn add @roshan-labs/http-module -D
```

## API

通过 `useHttp` 组合式函数导出以下 API 使用

### `create`

传入 `$fetch` 相同配置,创建新 `http` 实例

```ts
useHttp().create(options)
```

- options: `$fetch` 配置参数

### `request`

发起一个 `http` 请求

```ts
useHttp().request(url, options)
```

- url: 请求地址
- options: `$fetch` 配置参数

## License

MIT