Tips applet notes

React setData and the setState as is asynchronous it?

setData not asynchronous, but after setData UI updates are asynchronous. Because the logical layer (App Service) and the view layer (View) are separated. The second parameter is a callback setData the UI update.

This.data and this.properties components are the same as you? If the attribute name duplication how to do?

  1. this.data === this.properties return is ture
  2. key repeat properties will then cover data, it is time to initialize an instance of a component properties covered data.
  3. properties and is a data object is described properties can be modified, because the data can be modified (a bit messy, best not to modify the properties properties).

What view double braces behalf? Why the need to bind event string?

Double curly braces is an expression, the expression data from the current page of data or the component data / properties.

It noted that the view can not call methods in the current page instance, this and vue / react very different.

Parent component properties can not be passed to the method sub-components, which should be the cause of binding events need to use the string (but why methods can not pass through the properties it ???).

When property changes (observer) may setData it?

Attribute changes when you can set up other data.

Look how small program debugging information (console) real machine?

Applet can wx.setEnableDebugbe opened and closed debug mode API, and whether debug mode is no way to query.

Online small console program to see how the information?

First open debugging in development or trial version, and then cut to the official version will be able to see vConsole.

Many times a page is created with the relevant JS script several times to perform it?

Many times a page is created, JS file is located and the page will not be executed multiple times , generating more than just a page instance (this) according to preliminary data. JS file directly in the page defined variables , across all instances of the page is shared .

Why applet can not access the JS file object class window, document it?

Because JS files are not running in web-view environment.

On iOS, javascript code running applets JavaScriptCore logic layer, the layer is made of view to render the WKWebView, environment iOS8, iOS9, iOS10;

On Android:

javascript code running an older version, the applet X5 JSCore logical layer, the layer is formed from X5 view based on Mobile Chrome 57 to render the core;

The new version, javascript code to run a small program logic layer V8, the view layer is rendered based on the self-study XWeb engine Mobile Chrome 67 cores;

In the development of tools, javascript code for the applet is running in the logic NW.js layer, the layer is made of view to render the Chromium 60 Webview.

Applet how to obtain information related to the DOM object?

By wx.createSelectorQuery () method for obtaining SselectorQuery the object, the object information and query node. Note that when using the object selection range .

Applet how to obtain custom component instance?

By this.selectComponent ( 'selector') to obtain a component instance.

Buried exposure time required element applet can be seen only users to report, how to deal with more convenient?

By IntersectionObserver subject to

Published 48 original articles · won praise 52 · views 50000 +

Guess you like

Origin blog.csdn.net/letterTiger/article/details/90044120