This is the 8th day of my participation in the More text Challenge. For details, see more text Challenge

  1. Long data list optimization

    Wechat small program official prompt page allows a maximum of 1000 labels, so if you want to make 100,000 data smoothly display, you must reduce unnecessary label nesting and try to avoid frequent use of setData, multiple setData can be combined and encapsulated into a custom component

  2. Async /await resolves callback hell

    Async can execute subsequent code after the code written before the function and after the await is finished

  3. The life cycle

    OnLaunch (), onShow(), onHide(), onError(), onPageNotFound(), onPageNotFound() OnLoad ()[page loading, called only once], onShow()[show or foreground], onReady()[render completed, called only once], onHide()[background], onUnload()[Unload] Created ()[created instance just created], Attached ()[component goes to node tree after initialization], Ready ()[Component layout in view layer completed], Moved ()[component instance moved], detached()[number of nodes off the page] Life cycle of the component: Show ()[page display], hide()[page hide], resize()[page size change]

  4. The difference between bindTap and catchTap

    Bindtap allows event bubbling (clicking on the current element triggers to the parent element). Catchtap prevents event bubbling

  5. Routing Differences

    Wx.redirectto () navigateTo(); wx.redirectto (); Switch to a page wx.switchTab() Switch to a tabBar page wx.navigateBack() Close the current page and return to the previous or multilevel page wx.relaunch() Close all pages and open a page

  6. The login process

    The front-end uses wX.login () to obtain the code and sends the code to the developer server using wX.request (). The back-end calls the wechat interface to obtain session_key and OpenID and returns the login status to the front-end. The front-end stores the login status and can use the login status in subsequent business interfaces

  7. What apis are available for local storage

    Wx. setStorage Stores data to the local environment. Synchronized version of the previous wx.setStorageSync method. Wx. getStorage Gets the content corresponding to the key GetStorageInfoSync Synchronization version of the previous method wx.clearStorage Clears the local cache synchronization version of the previous method wx.clearStorageSync

  8. The method of passing data

    • Use the globalData() global variable

      Define var app = getApp() on the accepted page, and use app.globalData.key to get or modify the value

    • Route transmission parameters are used

      Use wX.nagivateto (), wX.redirectto () to concatenate parameters after the address to receive passed parameters in onLoad() on the receiving page

    • Using local cache

  9. Bidirectional binding of small programs

    This.setdata ({key: value}) must be used for bidirectional binding; this.data.key = value cannot be used for bidirectional binding

The article only writes part of the knowledge point, the detailed follow-up will be supplemented