没有合适的资源?快使用搜索试试~ 我知道了~
首页微信小程序实现图片上传
本文实例为大家分享了Android九宫格图片展示的具体代码,供大家参考,具体内容如下/p> 图片上传服务器: wxml <view class=container> <button bindtap='chooseImageTap'>上传图片</button> </view> wxss Page({ /** * 页面的初始数据 */ data: { imgs: [],//本地图片地址数组 picPaths:[],//网络路径 }, /** * 生命周期函数--监听页面加载 */ onLoad: function (options) { }, //添
资源详情
资源评论
资源推荐

微信小程序实现图片上传微信小程序实现图片上传
本文实例为大家分享了Android九宫格图片展示的具体代码,供大家参考,具体内容如下/p>
图片上传服务器:
wxml
<view class="container">
<button bindtap='chooseImageTap'>上传图片</button>
</view>
wxss
Page({
/**
* 页面的初始数据
*/
data: {
imgs: [],//本地图片地址数组
picPaths:[],//网络路径
},
/**
* 生命周期函数--监听页面加载
*/
onLoad: function (options) {
},
//添加上传图片
chooseImageTap: function () {
var that = this;
wx.showActionSheet({
itemList: ['从相册中选择', '拍照'],
itemColor: "#00000",
success: function (res) {
if (!res.cancel) {
if (res.tapIndex == 0) {
that.chooseWxImage('album')
} else if (res.tapIndex == 1) {
that.chooseWxImage('camera')
}
}
}
})
},
// 图片本地路径
chooseWxImage: function (type) {
var that = this;
var imgsPaths = that.data.imgs;
wx.chooseImage({
sizeType: ['original', 'compressed'],
sourceType: [type],
success: function (res) {
console.log(res.tempFilePaths[0]);
that.upImgs(res.tempFilePaths[0], 0) //调用上传方法
}
})
},
//上传服务器
upImgs: function (imgurl, index) {
var that = this;
wx.uploadFile({
url: 'https://xxxxxxxxxxxxxxxxxxxxxxxxxxxx',//
filePath: imgurl,
name: 'file',
header: {
















weixin_38695471
- 粉丝: 3
- 资源: 911
上传资源 快速赚钱
我的内容管理 收起
我的资源 快来上传第一个资源
我的收益
登录查看自己的收益我的积分 登录查看自己的积分
我的C币 登录后查看C币余额
我的收藏
我的下载
下载帮助

会员权益专享
最新资源
- ARM Cortex-A(armV7)编程手册V4.0.pdf
- ABB机器人保养总结解析.ppt
- 【超详细图解】菜鸡如何理解双向链表的python代码实现
- 常用网络命令的使用 ipconfig ping ARP FTP Netstat Route Tftp Tracert Telnet nslookup
- 基于单片机控制的DC-DC变换电路
- RS-232接口电路的ESD保护.pdf
- linux下用time(NULL)函数和localtime()获取当前时间的方法
- Openstack用户使用手册.docx
- KUKA KR 30 hA,KR 60 hA机器人产品手册.pdf
- Java programming with JNI
资源上传下载、课程学习等过程中有任何疑问或建议,欢迎提出宝贵意见哦~我们会及时处理!
点击此处反馈



安全验证
文档复制为VIP权益,开通VIP直接复制

评论0