微信控件使用文档

飞道科技

getimage-view

小程序展示选中图片控件

1. 属性

属性名 类型 默认值 是否必须 说明
wid String 控件的标示
upload_num Number 9 最大上传图片的数量
max_size Number 0 设置最大上传图片的大小,0为不受限制
is_delete_btn Boolean false 是否展示删除按钮
width Number 200 展示图片的宽度
height Number 200 展示图片的高度

2.方法

clear()

清空选中的图片

get_image()

获取选择的图片

返回值 string[]

使用示例:

wxml

<view>
  <upload-picture id='w0001' upload_max_num='9' style='width:100rpx;height:100rpx' is_delete_btn></upload-picture>

  <button bindtap='get_image'>获取选择的图片</button>
</view>

ts

import select_component from '@feidao/web/atom/wx/app/api/xml/select-component';

const widget = select_component('#w0001');
const images= widget.get_image();

// 如果你想将选中的图片上传的话 可以调用原子操作
import upload_file from '@feidao/web/atom/wx/app/api/network/upload-file';

const file=await upload_file('http://192.168.40.196/fsweb/upload?productid=jewelry_mall',images[0],'test')