JSPM

  • ESM via JSPM
  • ES Module Entrypoint
  • Export Map
  • Keywords
  • License
  • Repository URL
  • TypeScript Types
  • README
  • Created
  • Published
  • Downloads 1789
  • Score
    100M100P100Q106436F
  • License BSD-3-Clause

Package Exports

  • universal-choose-image

This package does not declare an exports field, so the exports above have been automatically detected and optimized by JSPM instead. If any package subpath is missing, it is recommended to post an issue to the original package (universal-choose-image) to support the "exports" field. If that is not possible, create a JSPM override to customize the exports field for this package.

Readme

universal-choose-image npm

选取图片

支持

browser miniApp wechatMiniprogram bytedanceMicroApp quickApp

安装

$ npm install universal-choose-image --save

使用

import chooseImage from 'universal-choose-image';

// 快应用中的引入方法
// import chooseImage from 'universal-choose-image/lib/quickapp;

chooseImage().then(res => {
})

方法

chooseImage(options)

选取照片数据

参数

成员 类型 描述 必选 默认值 支持
options object 选取照片参数 -
options.count number 最大可选照片数 1 browser miniApp wechatMiniprogram bytedanceMicroApp
options.sourceType array 相册选取或者拍照 camera, album miniApp wechatMiniprogram bytedanceMicroApp quickApp
options.accept string 允许的文件类型 image/* browser

返回值

成员 类型 描述
res object
res.data string[] Web 环境为 base64 数据,小程序中为图片路径
res.files File[] 仅 Web 环境存在,为原始的文件对象