Getting small uni-app development program to crash

The most recent company to do a small program projects, but also support micro-channel applet, applet headlines, Baidu applet. A set of code that implements three platforms. I was received this task, do not know how to start, set of code were to be published three platforms, and quickly went to the Internet to understand these things, looked at, uni-app, taro, Chameleon these three libraries, then every a run once, look at the document. When I finished running Chameleon project, directly to give up this, and drops the company developed a set of codes, multi-terminal use. Mainly just released not long, too little official instances, particularly special cratered. The document does not fully, simply Yangruhukou, however, see a good introduction, you can directly call Andrews and ios development, support hot update, the app integrates project Sdk. Rendering capability is still relatively strong. For taro multiport this framework, with better Chameleon some syntax is based on a combination of small programs and react, but also has its own set ul framework. In the materials market, there are many, many plugins for reference use, community activity is also possible. Finally talk about uni-app, also chose to use the uni-app in the project is really to enter the uni-app this framework, it is equal to the same tune with the tiger's mouth, stepped endless pit, finish the bug, but the main the syntax is simple, based vue, vue and can be said to be a small program, it is easy to use, can direct development projects,


uni-app platform written in three runs, only small micro-channel program to compile and run is the best, but the headlines and Baidu, must be opened manually in order to be the first time the compiler may not be able to compile successfully, after compilation, app. js file forgetful, people need to manually introduced three js files can. uni-app must use this method to compile condition. Use a lot about conditional compilation, separately for each operating platform will be 11 to say in the next issue encountered in the project.

1. After the code is compiled

The first compilation of small programs for each platform, you will find a small headline app.js program file, less the introduction of three important documents, and app.json profile did not, no matter how the compiler are indifferent, and finally no way only the other code directly copied, then run again, to take effect

 2. Official api method

In the project will be used to assist in the development of various api, but you will find a lot of small api Alipay does not support this place there is a pit, headlines applet option to upload a video, by calling uni.chooseVideo provided api, completely different effect in Andrews and ios show returned, only the editor does not Sha problem. . .

 

 

 Through the above code, to upload video

  On ios phone responent.tempFilePath, we return to the path is a string, but behind a string of stitching string http://127.0.0.1/file/2019/12/6/02566464616,mp4?sihvishhhis this format. But when we had a request, the background is not acceptable? String behind, resulting in the return of each upload video

  Path can not play, we must intercept out, or is intercepted or is the rear end of the front-end filter out the interception,

  In any Android models, as long as the Android model, upload photos No Sha problem, but as long as help you upload a video, you return to the local path there's no extension, returns as the following format, how do you know this background, I uploading something, and there is no sign, simply can not distinguish, then I rush to publish a headline applet forum to raise this issue, please see this link specific questions https://forum.microapp.bytedance.com / Mini-App / Posts / 5de87002725dee020c518e69 , said customer service

   Said is said, still needs its own research and study finally back, only to achieve,

  

   In fact, this problem can be said to exist in their official documents bug, I uploaded the video, you should at least return my upload is what format, and consequently do not return, ye know, this last question, and you need to communicate back and let the background determine what, he was sent to this format, through the background to return, although no path, but can be opened.

  Or is the background to return is that you add to mp4 format, the front end can not manually add your own, or not.

The end result is returned

  Upload after Taiwan returned json format obviously we want, but happens headlines and micro letter is to give you returns a string, needs its own JSON.parse escape it, but Baidu is not, it is that we want to return to the format, the need to look at.

  

3. conditional compilation common

  In the uni-app this is still very good, it can be conditional compilation for each platform, write different code, published on different platforms

 

   Common values

  

 

 

Finally, talk about, is to upload pictures when only micro-channel support and Baidu, the headline does not support base64, or choose to upload a file stream mode

4. The method of Baidu applets executed only once onShow

This is more uncomfortable, in Baidu applet onShow method only once, access to information to know that this is the official existence of the bug, has been repaired, but there is no update to the latest version, the feeling will soon send a version, this issue needs to develop its own tools upgrade to the latest version, it

 

  Select the latest version

 

 

The carrier and implement the down refresh LAC

Almost every item will be used to upload and down on Raja refresh this function, since each page can be used, through the use of movable-area to achieve the LAC upload and pull down to refresh, the results do not support the official explanation headlines, you can go to market plug-ins , which a lot of plug-ins that can be used

Only sub-processing platform

 

 

uni-app really is a set of code that can generate multiple platforms, but inside the pit needs its own time and study, still a lot of things missing, no way, only slowly stepped pits, accumulate more, in order to make good use of good

Published 76 original articles · won praise 71 · views 1847

Guess you like

Origin blog.csdn.net/Govern66/article/details/104290218