Taro Getting Started - WeChat Mini Program
Taro is an open cross-terminal and cross-framework solution that supports the use of React/Vue/Nerv and other frameworks to develop applications such as WeChat/JD/Baidu/Alipay/ByteDance/QQ applet/H5.
WeChat Mini Program is a new open capability, and developers can quickly develop a Mini Program. Mini programs can be easily acquired and disseminated in WeChat, and have an excellent user experience.
Taro depends on the Node.js environment, so you must download and install the Node.js environment on your machine from the following:
For more information about installing and using Node.js, see the Node.js - https://nodejs.org/en/
nvm is a version manager for node.js, designed to be installed per-user, and invoked per-shell. nvm works on any POSIX-compliant shell (sh, dash, ksh, zsh, bash), in particular on these platforms: unix, macOS, and windows WSL.
asdf-nodejs is a Node.js plugin for asdf version manager.
Homebrew installs the stuff you need that Apple (or your Linux system) didn’t.
WeChat Mini Program need a development and debugging tools, so you need download and install WeChat Developer Tools from the following:
WeChat Developer Tools is a web debugging tools to help developers develop and debug Weixin Mini Programs more simply and efficiently based on the original Official Account.
npm i @tarojs/cli
(Optinal) Upgrade Taro
taro update self
taro init [project name] to create a new project.
taro init col-taro-example
Check Taro information.
WeChat Mini Program
Use the following commands to compile Taro project to WeChat Mini Program.
Mini Program Developer Tools
Download and open the WeChat Developer Tools - https://developers.weixin.qq.com/miniprogram/en/dev/devtools/download.html, and then select
col-taro-example/dist directory as the project root directory to preview.
Need to pay attention to the project settings of the developer tools:
You need to set to turn off the ES6 to ES5 function, and it may report an error if it is turned on
You need to set to turn off the automatic completion of the style when uploading the code, and an error may be reported
You need to set the code compression upload to be disabled, and an error may be reported when it is enabled