npm package discovery and stats viewer.

Discover Tips

  • General search

    [free text search, go nuts!]

  • Package details

    pkg:[package-name]

  • User packages

    @[username]

Sponsor

Optimize Toolset

I’ve always been into building performant and accessible sites, but lately I’ve been taking it extremely seriously. So much so that I’ve been building a tool to help me optimize and monitor the sites that I build to make sure that I’m making an attempt to offer the best experience to those who visit them. If you’re into performant, accessible and SEO friendly sites, you might like it too! You can check it out at Optimize Toolset.

About

Hi, 👋, I’m Ryan Hefner  and I built this site for me, and you! The goal of this site was to provide an easy way for me to check the stats on my npm packages, both for prioritizing issues and updates, and to give me a little kick in the pants to keep up on stuff.

As I was building it, I realized that I was actually using the tool to build the tool, and figured I might as well put this out there and hopefully others will find it to be a fast and useful way to search and browse npm packages as I have.

If you’re interested in other things I’m working on, follow me on Twitter or check out the open source projects I’ve been publishing on GitHub.

I am also working on a Twitter bot for this site to tweet the most popular, newest, random packages from npm. Please follow that account now and it will start sending out packages soon–ish.

Open Software & Tools

This site wouldn’t be possible without the immense generosity and tireless efforts from the people who make contributions to the world and share their work via open source initiatives. Thank you 🙏

© 2025 – Pkg Stats / Ryan Hefner

@zebra-ui/axios-adapter

v1.0.1

Published

Axios adapter for UniApp

Downloads

1

Readme

介绍

zebra-axios-adapter 是一个用于 UniApp 的 Axios 适配器,支持小程序、H5 和 App 平台。

Axios 是一个基于 promise 网络请求库,作用于node.js 和浏览器中。由于小程序的请求机制不同,所以在小程序中并不能直接使用Axios。该适配器就是为了解决这个问题。

特性

  • 💪 完整的 TypeScript 支持。
  • 🔨 支持所有 UniApp 平台(小程序、H5、App)。
  • 🎨 支持文件上传和下载。
  • 🚀 支持上传/下载进度监听。
  • 🍭 支持请求和响应拦截器。
  • ⚡️ 支持请求超时配置。
  • 🍭 支持 baseURL。
  • ⚡️ 支持 validateStatus 自定义验证。
  • ⚡️ 支持 responseType 配置。
  • 📖 完善的错误处理。

安装

npm install axios-uniapp-adapter axios

基本使用

创建实例

import axios from 'axios'
import uniAppAdapter from '@zebra-ui/axios-adapter'

const instance = axios.create({
  adapter: uniAppAdapter,
  baseURL: 'https://api.example.com',
  timeout: 5000
})

常规请求

// GET 请求
instance
  .get('/users')
  .then((response) => {
    console.log(response.data)
  })
  .catch((error) => {
    console.error(error)
  })

// POST 请求
instance.post('/users', {
  name: 'John',
  age: 30
})

// PUT 请求
instance.put('/users/1', {
  name: 'John Doe'
})

// DELETE 请求
instance.delete('/users/1')

更多使用方式,请查看文档

示例项目

以下是 zebra-axios-adapter 官方提供的一些示例项目,你可以克隆该项目,并直接拷贝代码来使用。

示例项目中演示了如何使用请求拦截及通过api方式使用。

  • demo-normal:此示例项目使用 HbuilderX 创建应用,通过 uni_modules 引入zebra-axios-adapter。
  • demo-cli:此示例项目使用 VSCode 创建应用,通过 pnpm 引入zebra-axios-adapter。

文档网站

访问文档网站查看详细使用方法。

Zebra 生态

由 Zebra 官方维护的项目

  • zebra-ui 基于uniapp,使用vue3 + ts + setup 的多端兼容组件库。
  • zebra-swiper 基于uniapp,适配多端的高度自定义轮播组件
  • zebra-color 全端兼容的轻量级颜色选择器。

交流群

QQ群:947159437 点击加入