1.0.28 • Published 1 year ago

m-weixin-utils v1.0.28

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

m-weixin-utils

简洁,高效,实用的微信小程序方法封装 反馈错误/缺漏

Installation

npm i m-weixin-utils

Exampleusage

import { Server , Upload , Utils } from 'm-weixin-utils';

Page({
  onLoad(){
    //发起get请求
    Server.get("https://www.npmjs.com/package/m-weixin-utils");
    //发起post请求
    Server.post("https://www.npmjs.com/package/m-weixin-utils");

    //从相册选择上传图片
    Upload.chooseImage(9).then(urls=>{
      //返回上传地址[]
      console.log(urls);
    })
  }
})

Api

Upload Class

uploadFile(tempFilePaths:any)

tempFilePaths:上传参数临时路径参数

chooseImage(number?:number)

number:选择图片后自动上传返回上传路径参数(上传数量)默认1

Server Class

get(url:any,options?={},header?={})

url:地址 options:请求参数 header:请求头

post(url:any,options?={},header?={})

url:地址 options:请求参数 header:请求头

Utils Class

formatTime(date:string)

date:2022-10-10 | 2022/10/10

gourl(path:string)

path:跳转路径 网址会自动跳转到/pages/webview/index?url=${encodeURIComponent(path)}

get_html(data:any)

data:html字符串自动适配微信小程序rich-text

tapinfo(e:any)

e返回点击的参数data-id

getRect(obj:string)

obj : class/ID获取元素信息DOM

checkFullSucreen()

获取小程序头部胶囊按钮与顶部的距离

alert(content:string)

content:弹窗提示

msg(content:string)

content:弹窗提示

confirm(msg:string,opction?:opctionType)

msg 提示 opction 可参考小程序官方文档

getsys(key:string)

获取本地存储

delsys(key:string)

删除本地存储

setsys(key:string)

设置本地存储

previewImage(current:string,urls:string[])

需要预览的图片

requestSubscribeMessage(tmplIds:string[])

tmplIds模板ID列表

openDocument(url:string)

url需要打开的文件地址

checkUpdateVersion()

检测当前的小程序 版本自动更新

urlEncode(data: object = {})

对象转URL

setClipboardData(data: string, title?: string)

data 复制内容 title 复制成功提示 默认 复制成功

1.0.28

1 year ago

1.0.27

1 year ago

1.0.26

1 year ago

1.0.25

1 year ago

1.0.24

1 year ago

1.0.23

1 year ago

1.0.22

1 year ago

1.0.21

1 year ago

1.0.20

1 year ago

1.0.19

1 year ago

1.0.18

1 year ago

1.0.17

1 year ago

1.0.16

1 year ago

1.0.15

1 year ago

1.0.14

1 year ago

1.0.13

1 year ago

1.0.12

1 year ago

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