Problems encountered in developing small programs

Problems encountered in developing small programs

Mini Program Project Structure

*pages //Business set

*utils // public set, called by require()

app.js //The main program, which can define the life cycle and public methods\global variables of the entire applet, which can be called by var app = getApp();app.

app.json//Main configuration, configure which pages the applet consists of, configure the window background color of the applet, configure the navigation bar style, and configure the default title. Note that no comments can be added to this file.

app.wxss//Public style sheet

 

  1. The connection reports 403 Forbidden: cross-domain problem, set head:Access-Control-Allow-Origin on the server Example: response.setHeader("Access-Control-Allow-Origin", "*");
  2. JSON.parse(string) SyntaxError: Unexpected token ' in JSON at position :格式问题,{img:http://..},{"img":http://..}都要改为 {"key":"value"} 例:{"img":"http://.."}
  3. You can use `` to concatenate strings, and use ${} to output variables, for example: var data=`{"img":"${url}"}`
  4. scroll-view>scroll-into-view positioning is not accurate, use unshift to insert data at the front of the array
  5. <input type="text" value="{{inputValue}}" bindinput="binginput"/> inputValue can control the input content, inputValue will not change in the input input content, define, define binginput:function(e){ in Page this.setData({inputValue:e.detail.value})}

 

Guess you like

Origin http://43.154.161.224:23101/article/api/json?id=325558642&siteId=291194637