Home  >  Article  >  Web Front-end  >  Let’s talk about how to convert a small program project into a uni-app project

Let’s talk about how to convert a small program project into a uni-app project

青灯夜游
青灯夜游forward
2022-02-01 09:00:318886browse

How to convert a small program project to a uni-app project? The following article will introduce to you the method of converting WeChat applet into uni-app project. I hope it will be helpful to you!

Let’s talk about how to convert a small program project into a uni-app project

When I was working on a uni-app project before, the front end needed to implement a relatively complex dynamic tab and swiper switching function, but due to my own front-end lameness, I didn’t. I wrote it out, and then when I searched on the Internet, I found a page in a WeChat applet that perfectly met my needs. So the question is, how do I convert the WeChat applet into a uni-app project? After searching for relevant solutions on the Internet, there is indeed a project to convert WeChat mini programs into uni-apps. The name of the project is [miniprogram-to-uniapp]. Let’s see how to put it into practice!

miniprogram-to-uniapp project introduction:

Summary introduction: It is an open source project that can convert WeChat projects into Uni-app projects

github address: https:/ /github.com/zhangdaren/miniprogram-to-uniapp

Usage Guide: https://ask.dcloud.net.cn/article/36037

Step one, install on window NPM package management tool:

Since this project needs to use the NPM package management tool to install the corresponding project package, and NPM is a package management tool installed along with NodeJS, so next we only need to install and configure node.js OK.

Node.js installation and configuration detailed tutorial: https://www.runoob.com/nodejs/nodejs-install-setup.html

Second step, initialize an NPM module:

First check the NPM version:

##Create a new blank file in any disk Folder, used to store NPM initialization module configuration:

Use CMD to enter the corresponding folder and enter:

npm initCommand

The third step is to use miniprogram-to-uniapp to convert the WeChat applet into a uni-app instance:

First download the WeChat applet that needs to be converted:

For demonstration purposes, I randomly downloaded a WeChat mini program mall. The project address is: https://github.com/hanxue10180/shangcheng

The following picture shows the basics of the WeChat mini program Structure:

## Install miniprogram-to-uniapp and convert the mini program into a uni-app project:

Because this package is a tool and requires global use, it requires -g for global installation. Run the following command to install:

npm install miniprogram-to-uniapp -g

After the installation is complete, execute the following command to check the tool version:

(wtu -> is taken from wx to uni, this global command will be used later)

wtu -V

Run the following command to convert the WeChat applet into a uni-app project:

In the command line, enter [

wtu -i "you Mini program project path "

], note that there is a space after -i! ! ! For example: [wtu -i "G:\shangcheng"] ;After pressing Enter, you can get a directory with the suffix _uni in the source project and directory, that is, the conversion is successful. As shown in the figure below:

It’s done and successfully transformed into the uni-app project structure:

Recommended: "

uniapp tutorial

"

The above is the detailed content of Let’s talk about how to convert a small program project into a uni-app project. For more information, please follow other related articles on the PHP Chinese website!

Statement:
This article is reproduced at:cnblogs.com. If there is any infringement, please contact admin@php.cn delete