1.0.11 • Published 1 year ago

sunrise-tools v1.0.11

Weekly downloads
-
License
MIT
Repository
-
Last release
1 year ago

曦工具函数库

安装

npm install sunrise-tools

使用方法

http请求使用

import { createHttp, HttpParamsType } from 'sunrise-tools'

const data: HttpParamsType = {
  baseURL: '',
  json: false,
  token: false,
  timeout: 0,
  callback: () => {}
}

const baseApi = createHttp(data)

baseApi.get('接口名称', '参数')

baseApi.post('接口名称', '参数')

baseApi.delete('接口名称', '参数')

message提示框使用

import { Success, Error, Warning, Confirm, Alert } from 'sunrise-tools'

Success('') // 参数1: 提示信息, 参数2:持续时间 默认 2000
Error('') // 参数1: 提示信息, 参数2:持续时间 默认 2000
Warning('') //参数1: 提示信息, 参数2:持续时间 默认 2000
Confirm({
  message: ''
})//参数: ConfirmConfigType
Alert('') //参数: 提示信息

列表合计使用

import { countSum, countSumAll } from 'sunrise-tools'

countSum(data, 'a') // 参数1: 数据对象json, 参数2:合计属性
countSumAll(2, 5) // 参数1: 除数, 参数2:被除数

websocket搭建使用

import { closeWebSocket, createWebSocket, sendMessage, getSocket } from 'sunrise-tools'

createWebSocket('链接') //创建websocket
sendMessage('数据') //发送消息
getSocket('回调函数') //接收消息
closeWebSocket() //关闭websocket
1.0.11

1 year ago

1.0.10

1 year ago

1.0.9

1 year ago

1.0.8

1 year ago

1.0.7

1 year ago

1.0.6

1 year ago

1.0.5

1 year ago

1.0.4

1 year ago

1.0.3

1 year ago

1.0.2

1 year ago

1.0.1

1 year ago

1.0.0

1 year ago