Network Security Internet Technology Development Database Servers Mobile Phone Android Software Apple Software Computer Software News IT Information

In addition to Weibo, there is also WeChat

Please pay attention

WeChat public account

Shulou

How to implement chooseImage in WeChat Mini Programs to select pictures or take pictures

2025-03-26 Update From: SLTechnology News&Howtos shulou NAV: SLTechnology News&Howtos > Development >

Share

Shulou(Shulou.com)05/31 Report--

This article mainly introduces "how to achieve chooseImage in WeChat Mini Programs to choose pictures or take pictures". In daily operation, I believe many people have doubts about how to achieve chooseImage in WeChat Mini Programs to choose pictures or take pictures. The editor consulted all kinds of materials and sorted out simple and easy-to-use methods of operation. I hope it will be helpful to answer the questions of "how to achieve chooseImage to choose pictures or photos in WeChat Mini Programs". Next, please follow the editor to study!

WeChat Mini Programs chooseImage chooses a picture or a photo.

First, use API wx.chooseImage (OBJECT)

Var util = require ('.. /.. / utils/util.js') Page ({data: {src: ".. / image/pic4.jpg"}, gotoShow: function () {var _ this = this wx.chooseImage ({count: 9, / / maximum number of images that can be selected). Default is 9 sizeType: ['original',' compressed'], / / original original image, compressed compressed image By default, both have sourceType: ['album',' camera'], / / album selects pictures from albums, and camera uses cameras. By default, both have success: function (res) {/ / success console.log (res) _ this.setData ({src:res.tempFilePaths})}, fail: function () {/ / fail}, complete: function () {/ / complete}})}

Second, the image path for data binding

Click to upload photos

Extra:

1. Wx.chooseImage calls camera or photo album

2. Data binding

3. Dynamically modify the file path in js

Var _ this = this wx.chooseImage ({count: 9, / / the maximum number of pictures that can be selected. Default is 9 sizeType: ['original',' compressed'], / / original original image, compressed compressed image. By default, both have sourceType: ['album',' camera'], / / album selects pictures from photo albums, and camera uses camera. By default, both of them have success: function (res) {/ / success console.log (res) _ this.setData ({src:res.tempFilePaths})}, fail: function () {/ / fail}, complete: function () {/ / complete}. This is the end of the study on "how to implement chooseImage to choose pictures or take pictures in WeChat Mini Programs". I hope I can solve everyone's doubts. The collocation of theory and practice can better help you learn, go and try it! If you want to continue to learn more related knowledge, please continue to follow the website, the editor will continue to work hard to bring you more practical articles!

Welcome to subscribe "Shulou Technology Information " to get latest news, interesting things and hot topics in the IT industry, and controls the hottest and latest Internet news, technology news and IT industry trends.

Views: 0

*The comments in the above article only represent the author's personal views and do not represent the views and positions of this website. If you have more insights, please feel free to contribute and share.

Share To

Development

Wechat

© 2024 shulou.com SLNews company. All rights reserved.

12
Report