微信小程序本地服务器路径,微信小程序上传多图到服务器并获取返回的路径

// pages/comment/cmment.js

const app = getApp()

Page({

/**

* 页面的初始数据

*/

data: {

mes:{},

content:'',

tempFilePaths:[],

userInfo: {},

hasUserInfo: false,

canIUse: wx.canIUse('button.open-type.getUserInfo'),

images:[],

temp:0,

infoId:'',

sendtype:''

},

/**

* 生命周期函数--监听页面加载

*/

onLoad: function (options) {

console.log(options.infoId+"infoID")

this.setData({

infoId: options.infoId,

sendtype: options.sendtype

})

},

/**

* 页面上拉触底事件的处理函数

*/

onReachBottom: function () {

},

confirmSubmit:function(e){

console.log(e.detail.value)

},

//点击选择图片

chooseimage:function(){

var that = this;

wx.chooseImage({

count: 9, // 默认9

sizeType: ['original', 'compressed'], // 可以指定是原图还是压缩图,默认二者都有

sourceType: ['album', 'camera'], // 可以指定来源是相册还是相机,默认二者都有

success: function(res) {

that.setData({

tempFilePaths: that.data.tempFilePaths.concat(res.tempFilePaths)//在已有的基础上进行拼接

})

that.upload();

that.setData({

temp: that.data.tempFilePaths.length//用来解决 for 循环比 异步 快

})

}

})

},

//点击删除图片

delete: function (e){

var index = e.currentTarget.dataset.id;

this.data.tempFilePaths.splice(index,1)

//渲染数据

this.setData({

tempFilePaths: this.data.tempFilePaths

})

},

//提交评论

评论
添加红包

请填写红包祝福语或标题

红包个数最小为10个

红包金额最低5元

当前余额3.43前往充值 >
需支付:10.00
成就一亿技术人!
领取后你会自动成为博主和红包主的粉丝 规则
hope_wisdom
发出的红包
实付
使用余额支付
点击重新获取
扫码支付
钱包余额 0

抵扣说明:

1.余额是钱包充值的虚拟货币,按照1:1的比例进行支付金额的抵扣。
2.余额无法直接购买下载,可以购买VIP、付费专栏及课程。

余额充值