Uniapp need not say more, the development of small procedures fast and convenient, will be able to get started vUE, a set of code multi-terminal operation. Uniapp official documents for different platforms of API compatibility problems do platform differences, find the platform documentation API to write conditional compilation can be, the following mainly want to talk about running for headlines small program encountered custom components compatibility problems and other compatibility problems did not say.

1. Use wechat applets to customize the component, but the component cannot be found when running as headlines applets!!

Solution: This is because of the differentiation of small program components stored in the directory, the compilation of the differentiation platform directly copy the past, the wechat small program custom components in the headline developer tool one-click move function is generated headlines small program components, in the ttComponents below SRC, Even then, there are incompatibilities in component properties that need to be addressed in detail. If there are still styles that don’t work in the headlines, try inline styles.

2. When the uni-popup third-party component is used, the Scrollview component fails to scroll on the real machine

Solution: I tried all kinds of methods to modify the scrollview component, but all failed. Finally, I found that it would be good to remove the control of the sliding penetration event to prevent the event from bubbling in the uni-popup.vue file. @touchmove.stop. Prevent =”clear”

3. Uni-popup uses a custom component, does not do any operation to close the popup window after the second popup, in the headlines the custom component style state does not change with the change of the data inside the component, but wechat mini program is completely without any problems…

Solution: Add V-if =” Control popup variables “to the custom component label, which is equivalent to forcing the refresh of the component state every time it pops up

Uni. getClipboardData Obtains the system clipboard content. No message is displayed indicating that the content is copied successfully

Solution: even though the document set after the clipboard contents, small application platform automatically pop up light, but in fact WeChat small program on ios mobile pop-up prompts, only android phones don’t pop up, while the headlines applet doesn’t pop up on ios and android, so still honestly to add a bigger tips, will not repeat the pop-up.

5. The background color of android phone is black after the poster generated by canvas in toutiao app is saved locally, but there is no problem with iPhone, vomiting blood…

Solution: Lead to this problem is canvas fillStyle property and small application API canvasContext setFillStyle attribute differences, WeChat small program different phones can compatible fillStyle property, but in the headline applet doesn’t work, I’m going to change fillStyle to setFillStyle and I’m going to do it perfectly, but you should be aware that sometimes native API is used.

6. Save the Canvas image to the local blur problem

Solution: It looks fine on the real machine debugging and development tools, but it is very fuzzy on the headlines applet after saving it to the phone, check all apis, and finally find the problem is uni.canvastotempFilepath (Object, Component). Exports the contents of the specified area of the current canvas to generate a picture of the specified size, and returns the file path. I passed canvasId, width and height. At first, I thought it was due to fileType and quality, but it didn’t work. Finally, I passed the default values of destWidth and destHeight. Finally, it was found that these two parameters need to be passed, which is also very pit Dad clearly not required to pass.

7. View location requires user authorization and does not support map component. There is no way to use this component.

8. Failed to obtain the qr code of the small program and scan the code to enter the formulation page.

Solution: The official document of the small program says that the path of the small program should be encode once, such as Pages % 3fParam % 3dTrue, so I use encodeURIComponent to encode the URL, because the small program is not online and can not test the jump is correct. The result was that it failed to jump to the home page by default after it went online. After trying to remove encodeURIComponent or replace it with encodeUri, it finally entered the correct page after scanning code. The authorities screwed me again.

Add: encodeUri is to encode the uri, encodeURIComponent to. Com behind a coding.
EncodeUri does not encode special characters that are urIs themselves (: / #?). , encodeURIComponent is to encode all non-standard characters


Conclusion: these questions are summarized at present, and then there are new questions to update. If you also encounter some strange problems, you can leave a message, and we can communicate and explore together.