|selectComponent||Recommended to refactor with React ref|
|selectAllComponents||Recommended to refactor with React ref|
|selectOwnerComponent||Recommended to refactor with React ref|
|externalClasses||Taro 3 does not have custom components, it is recommended to standardize class names or use CSS Module instead|
|Circulation||[Some grammar restrictions apply]|
|Event||Some grammar restrictions apply|
|Citation||Some grammar restrictions apply|
|wxs||Some grammar restrictions apply|
In native development, the public logic of App, Page, and Component construction objects are often integrated into base classes.
Taro only recognizes the
Component() calls that exist in the entry, page, and component files at compile time, and these calls do not exist when the configuration is wrapped using the base class. So the compiled
withWeapp gets the parameter
Therefore we need to manually modify.
The custom component in WeChat mini program will generate a React/Vue component in Taro after conversion.
However, the components developed in Taro using React/Vue will not generate the corresponding mini program custom components when compiled to the mini program platform.
Therefore, the style isolation feature of the WeChat mini program custom component is lost after the conversion to Taro.
- Modify the conflicting selector.
- Use CSS Modules to rewrite.
JSX is achieved by manipulating
AST, and there are some writes that may not take into account, or may be difficult to adapt, resulting in error reporting.
The following are some known issues that need to be fixed manually.
1.1 Component conversion error when using both
wx:if statements are used on the component, and the current loop element item or loop subscript index is used as the judgment condition, the conversion will report an error.
As you can see in the above example, for the conversion of conditional statements, the current processing extracts the condition outside the component. However, if the condition uses
index, such extraction logic will result in an error reporting variable not defined.
For the time being, this can be fixed manually by fixing.
Method 1, modify the code before compiling to split the loop and conditional statements into two components.
Method two, modify the code of post-compile to put the conditional judgment into the loop body.
1.2 The root element cannot contain the
A space is required to the right of the apostrophe "<". #4243
Check for the following writing style.
Look at the compiled JSX to see if the variable was removed from
this.data because it was omitted, eg:
The variable name in
this.data should not be the same as the variable name used to specify the current subscript of the array, which defaults to
item, or the variable name specified by
Construct regular expressions using
1.6 The use of
<template> is not supported in
- Events do not support binding strings.
catchtouchmoveconversion only stops the callback function from bubbling, it does not prevent scroll-through. To prevent scroll-through, you can manually add the
catchMoveproperty to the compiled
- Event capture phase is not supported.
- Responding to events with WXS functions is not supported.
- Mutually exclusive event binding
mut-bindis not supported.
- Does not support
markto identify the specific target node that triggered the event.
Possible error messages encountered.
- Cannot assign to read only property 'exports' of object
- export '[something]' (imported as '[name]') was not found in '[somePath]'
Where the mini program API is used, Taro will convert
Taro.api() and add
import Taro from '@tarjs/taro to the header of the file.
If this file originally used CommonJS to organize the module, it may cause problems and need to be fixed manually.
- must be in the
readylife cycle to call the mini program API to get the DOM. 2.
- You don't need to call
Taro will process the src of the
src is a dynamically spliced string, you need to modify it manually:
src is a dynamically spliced string.
Possible error messages encountered:
- The "path" argument must be of type string. Received type undefined
Does not support converting the following writeups.#4749：
Taro can currently only convert
require strings to be written.
Temporary manual handling #5131。
For more questions on reverse conversion, please refer to the Taroize related Issues。