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 🙏

© 2024 – Pkg Stats / Ryan Hefner

request-uni

v1.0.0

Published

这是个 关于小程序请求的包 是小程序也能像axios一样发送请求 目前支持 uniapp、微信小程序、支付宝小程序

Downloads

8

Readme

request-uni 使用须知

📢这是个 关于小程序请求的包 是小程序也能像axios一样发送请求 目前支持 uniapp(默认)、微信小程序、支付宝小程序

1.先安装

npm i request-uni

2.在项目中的main.js的文件中引入reules 并全局挂载 名字

import { request } from 'request-uni'

request.BASE_URL = 'http://xx.xx.xx.xx:8084'

Vue.prototype.request_XQ = request

3.有两种使用方式( .get .post .put .delete) .$http 白色的框框是参数

内置的校验方法

| 方法名称 | 参数名称 | 参数作用 | 是否必填 | 参数类型 | 默认值 | | :------: | :------: | :----------------------------------------------------------: | -------- | -------- | ------ | | get | url | 请求地址 | 是 | String | 无 | | | data | 请求数据 | 否 | object | 无 | | | special | 是否处理返回的数据 | 否 | Boolean | false | | | timeout | 请求超时时间 | 否 | number | 60000 | | post | 同上 | 同上 | | | | | put | 同上 | 同上 | | | | | delete | 同上 | 同上 | | | | | $http | optinos | 是一个对象包含(url, method, data, timeout, header)这些参数 | 是 | object | 无 | | | special | 是否处理返回的数据 | 否 | Boolean | false |

request常用配置项

| 参数名称 | 参数作用 | 默认值 | 参数类型 | | ------------- | ----------------- | ------ | ------------ | | BASE_URL | 公共请求url地址 | null | string 必填 | | beforeRequest | 请求拦截器 | null | function | | afterRequest | 请求响应拦截器 | null | function | | global_OBJ | 用于存储全局对象 | { } | object | | global_ARR | 用于存储全局数组 | [] | Arrar | | global_TOKEN | 用于存储全局tuken | ' ' | string | | defaultHeader | 默认请求头 | { } | Object |

📢这个我设置默认的请求头 会自动带上token 内存中的 如果不需要 请设置为{ }

request 默认的全局配置 可修改

DEFAULT_CONFIG

下面这些参数都是在📢DEFAULT_CONFIG这个对象里面配置

| 参数名称 | 参数作用 | 默认值 | 参数类型 | | --------------------------- | ------------------ | ------------------------- | -------- | | CONFIG_HTTP_SUCCESS_CODE | 请求成功的状态码 | 200 | number | | CONFIG_RESET_LOGIN_CODE | 重新登录的code🐴 | 401 | number | | CONFIG_RESET_LOGIN_PAGE_SRC | 重新登陆的页面路径 | '/pages/index/index' | string | | CONFIG_DEFAULT_TIMEOUT | 超时时间,单位 ms | 60000 | number | | CONFIG_DEFAULT_METHOD | 默认请求方式 | GET | string | | CONFIG_APP | 小程序类别 | uni( 微信:wx,支付宝:my) | string |

📢有想法,有bug,不会使用,加群我告诉你啊