current position:Home>Ruoyi mobile terminal Ruoyi-App - use uview2.0 to develop photo upload or upload from mobile phone album

Ruoyi mobile terminal Ruoyi-App - use uview2.0 to develop photo upload or upload from mobile phone album

2022-11-24 12:05:09Whales elder sister

This article uses the upload component of uView2 to upload from the mobile phone album, and you can also upload photos.This component can upload pictures on Mini Program, h5, and App side, which is easy to use.

1. Front-end code

 

2. Read photos or upload photos

4. The configuration in manifest.json is as follows, real machine debugging needs to configure target: local machine IP and 8080 backend port number.

 "h5" : {"template" : "static/index.html","devServer" : {"port" : 9090,"https" : false,"disableHostCheck" : true, //Set to skip host check"proxy": {"/dev-api" : {"target" : "http://192.168.0.333:8080", //target interface domain name"changeOrigin" : true, //whether cross domain"secure" : false, // Set a proxy that supports the https protocol"pathRewrite":{"^/dev-api":""}}}},

5. Using the real-device debugging of the WeChat tool, you can select "photograph" or "select from mobile phone album" in the form of a small program on the mobile phone.

6. The effect of using h5 in the browser is as follows

copyright notice
author[Whales elder sister],Please bring the original link to reprint, thank you.
https://en.hqmana.com/2022/328/202211241159101934.html

Random recommended