Data: { IMG: [], // provided an array } add_img: function () { var that = the this , IMG = that.data.img; IF (img.length <. 3) { // if the number is less than three image , images may be acquired directly wx.chooseImage ({ COUNT: . 1, // default. 9 SizeType: [ 'compressed'], // can specify the still picture compression FIG default both have sourceType: [ 'album', ' camera '], // You can specify the source of the album or camera, both have default Success: function (RES) { var= res.tempFiles tempFilesSize [0] .size; // Get the image size, the unit B IF (tempFilesSize <= 2,000,000) { // Image Image acquisition may be performed less than or equal to 2M var tempFilePaths res.tempFilePaths = [0]; // get image that.data.img.push (tempFilePaths); // add to the array that.setData ({ IMG: that.data.img }) } the else { // image is larger than 2M, a pop-up message box wx.showToast ({ title: 'upload pictures can not be greater than 2M!', // title icon: 'none' // icons none Do not use the icon, details see the official document }) } } }) } the else { // direct pop up a prompt box greater than three wx.showToast ({ title: 'upload pictures can not be greater than 3 Zhang '! , icon: ' none ' }) } }