uni-app Select Image
1 <template> 2 <view> 3 <button type="primary" @click="img">button</button> 4 <button type="primary" @tap="info">info</button> 5 </view> 6 </template> 7 8 <script> 9 export default { 10 Data () { . 11 return { 12 is 13 is } 14 }, 15 Methods: { 16 // IMG: function () { . 17 // uni.chooseImage ({ 18 is // // COUNT: Number of photos uploaded allowed . 19 // COUNT :. 5, 20 is // // SizeType: Original picture, compression compressed FIG default both have 21 is // SizeType: "Original", 22 is // Success: function (RES) { 23 is // the console.log (RES ) 24 // } 25 // }); 26 is // }, 27 IMG () { 28 uni.chooseImage ({ 29 // COUNT: number of pictures allowed to upload 30 COUNT: . 5 , 31 is // SizeType: Original artwork, FIG Compressed compression, both have default 32 SizeType: " Original " , 33 is Success (RES) { 34 is the console.log (RES) 35 uni.previewImage ({ 36 // for the selected preview image 37 URLs: res.tempFilePaths, 38 is // URLs: [ '', ''] of the image address which is an array 39 }) 40 } 41 is }); 42 is }, 43 is info () { 44 is uni.getImageInfo ({ 45 the src: ' HTTP: //tmp/touristappid..4zDrukCye8Nz43bf15211b0e1e455089ee0b03dac6b7.png ' , 46 is Success (RES) { 47 the console.log (RES) 48 } 49 }) 50 } 51 // info:function(){ 52 // uni.getImageInfo({ 53 // src:'http://static.hcoder.net/public/images/logo.png', 54 // success: function(res){ 55 // console.log(res) 56 // } 57 // }) 58 // } 59 } 60 } 61 </script> 62 63 <style> 64 65 </style>
I recently feel nothing except copy the code up other operations, also lacks renderings