1. Small program quickly create page file method?

Add a path to a page to the Pages array in app.json. If the path points to a file that does not exist, the MINA framework automatically creates four pages of the page. The advantage of creating a file this way is that not only is it fast, but the page file automatically adds some default code to prevent the following two Q&A errors in the applet.

2. WXSS compiler error how to solve this problem

Solution: Type openVendor() on the console, clear WCSC and wcsc.exe, and restart the tool

3. Applets domain name requirements

  • Applets must begin with HTTPS
  • And it needs to be configured in the development Settings

4. What are the requirements for the jump between small programs

  • Applets associate with the public number To associate with the public number, the applets administrator must pass
  • Jump between small programs must be bound to the same public number

5. How to obtain openId, sessionKey, and unionId

Send res.code to the background for openId, sessionKey,unionId in wx.login in app.js

6. Release process of applets

  1. Independent mode: upload the development tool, log in the mini program account on wechat public platform, and submit it for review in version management
  2. Template mode:
  • Upload the development tool, and then log in the public account on wechat open platform.
  • Third party platform → corresponding public number point details → development configuration → add the corresponding version to the template library
  • Give the version number and generated template Id to the test or backend.

7. What are the methods of transferring data between pages of applets?

  • Define global variables in app.js and introduce them in each page
  • Use local cache setStorageSync getStorageSync
  • Use the route jump to pass in the parameters after the URL in the child page using the onLoad function with the options parameters
  • The myevent event is passed through this.triggerEvent(‘myevent’, myEventDetail)

8. How do pages communicate with components?

  1. Communication transmission
  • Parent-passed children are accepted in the child component using properties
  • The parent sets the myevent event to the component via this.triggerEvent(‘myevent’, myEventDetail)
  • Use local cache setStorageSync getStorageSync
  1. Component creation and reference
  • Create a Components component at the same level as Pages
  • Reference the component in the JSON file of the page
    {
    "usingComponents": {
        "Component Name":"Component path"}}}Copy the code
  • In the WXML file quote example:<songList id='songList'></songlist>

9. Route forward mode

  • Horizontal jump: wx.redirectTo, no return key
  • NavigateTo: wx. NavigateTo, with back key
  • Jump to the page with tabBar: wx.switchTab
  • Jump to any page: wx.reLaunch, no back key
  • Note that with navigateTo, redirectTo can only open non-Tabbar pages

Life cycle function of applets?

Application lifecycle functions: onLaunch listening applet initialization, onShow display, onHide hide, onError listener, onPageNotFound page no listener

Page life cycle functions: onLoad page loading, onShow display, onReady page rendering complete, onHide hide, onUnload page unloading

Component lifecycle functions: Created when a created component is just created, attached when the component enters the page node tree, Ready when the view layout is finished, moved when the moved component is moved to another location in the node tree, detached when the detached component is removed from the page, and error component methods throw errors

What is the difference between target and currentTarget in applets?

Target refers to the currently clicked component and currentTarget refers to the event captured component

The difference between bindtap and catchtap

  • The bindtap element binds events, and the parent node binds events to bubble, meaning that the event binding does not prevent bubbling events from bubbling up.
  • The Catchtap does not bubble and only fires at the current element, i.e. the event binding prevents bubbling events from bubbling up

13. How to implement drop-down refresh

  • Configuration in JSON: enablePullDownRefresh: true
  • Call the onPullDownRefresh function

14. Download resources to the local program, how to persist the file

When a file resource is downloaded to the local PC, the client directly initiates an HTTP GET request and returns the local temporary path of the file. The temporary path of the file can be used normally during the startup of the applet. If the file needs to be persisted, you need to actively call wx.saveFile to access the file at the next startup of the applet.

15. What determines the tabBar at the bottom of the page? How do I change the tabBar position

  • The tabBar at the bottom of the page is determined by the page.
  • You can configure the bottom bar or the top bar in app.json by changing the position.
  • A tabBar has a minimum of two and a maximum of five.

16. Rendering in applets

{{}}, interpolation

17. Definition and use of templates

  • Use the name attribute as the template name
  • Using the IS attribute, declare the template you want to use, and pass in the data you need for the template

18. Briefly say a few small program instructions

Wx :for, wx:for-item, wx:show, wx:hide, wx:if, wx:elseif, wx:else

19. How to dynamically bind classes, styles, etc.

Ternary expression

class=”{{orderMeetingArray.length ? ‘showformbtn’:’hideformbtn’}}”

20. A few small programsThe event

Bindtap, catchtap, longpress, touch(start, move, Cancel, end), transitionEnd, etc

21. How to solve the problem that drop-down refresh cannot be used with scroll view

Replace the Scroll View component with the View component and the event with onReachBottom

22. A unit of length in applets

RPX, general design is 375/750

23. About this.data and this.setData

The general setData method is mostly used to change the page information after clicking or to interact with the background to obtain the latest information after refreshing

  • Modifying this.data directly without calling this.setData will not change the state of the page and will cause data inconsistencies
  • A maximum of 1024kB of data can be configured at a time. Do not set too much data at a time.

24. How to determine the uniqueness of the user associated with the small program wechat public number?

With the wx.getUserInfo method withCredentials set to true, you can get the encryptedData, which contains the union_id. Symmetric decryption is required on the back end

25. How is bidirectional binding of applets different from vUE?

This. Data attributes cannot be synchronized to the view directly from the applet. This. SetData ({}) must be used.

    this.setData({
      noBind:true
    })
Copy the code

26. Block the refresh operation after the applet goes out?

The onHide() function is triggered when the applet goes out, and it does something with it.

27. Have you used the modal frame? Have you stepped on any holes

Open answer. (example: if icon is not None in wx.showToast, the title text will display a maximum of 7 Chinese characters)

28. Introduce several cross-end development frameworks (applets, H5) and their advantages and disadvantages

wepy mpvue taro uni-app
Grammar style Class vue vue React supports JSX vue
Multiterminal reuse Wechat, Alipay, Baidu Wechat, Alipay, Baidu, Bytedance H5, wechat, Alipay, Baidu, Bytedance, QQ mini program, Fast application, ReactNative H5, wechat, Alipay, Baidu, Bytedance, QQ mini program, Android, ios
It costs Be familiar with VUE and learn wePY Be familiar with VUE Be familiar with React Familiar with VUE and uni-APP
componentization Custom componentization Vue component specification React Component specification Applets component specification
The scaffold wepy-cli vue-cli taro-cli vue-cli
Build tools Build tools are built into the framework webpack webpack webpack
Style specification Less/Sass/Stylus/PostCss Less/Sass/Stylus/PostCss Less/Sass/Stylus/PostCss Less/Sass/Stylus/PostCss

Supplement: From the following figure