Pitfalls encountered during the development of WeChat applet

1. Native

Problem: WeChat Mini Program uses POST method to request the problem

Solution: When using the post method to request wx.request(), you need to add a header. The value of header[content-type] is application/x-www-form-urlencoded, otherwise the request will fail.

Problem: the text tag will parse the enter key 

Solution: do not use the enter key

Two, wepy framework

Problem: After the mini program is released, it needs to be clicked twice to update

For example, in the project: carousel diagram, login function wx.login() to get code value, search function, etc.

Solution: Asynchronous operations need to be added: this.$apply() 

Problem: Older projects are migrated to applets and rich texts are obtained. WeChat applet cannot be parsed

For example in the project: product detail page

Solution: Introduce the plug-in wxParse.js, import require in the js file,

var WxParse = require( ' ../wxParse/wxParse.js ')

Add in component

< import src= " ../wxParse/wxParse.wxml " />
< template is= " wxParse " data= " { { wxParseData :article .nodes }} " />

Three, weui

Problem: navbar component, adding your own class name is invalid

Solution: nest another view and edit your own class name


Guess you like

Origin blog.csdn.net/m13302979400/article/details/80928692