Create a uniapp H5 project that can be packaged and developed offline

Install node environment

slightly

Install vue scaffolding, online

npm install -g @vue/cli

PS: vue-cli has entered maintenance mode. The latest scaffolding of vue3 is installed using npm init vue@latest. After installation, use create-vue to replace the vue command. The bottom layer of create-vue uses vite to improve front-end development efficiency (Note16.0+)

Use the command to create a uniapp project, online

By default, https://registry.npmmirror.com is used as the mirror source.

vue create -p dcloudio/uni-preset-vue my-project

Choose a template

Insert image description here

Insert image description here

If you cannot download it, you can use offline mode and specify the template location to be used locally.

Download uniapp offline template, online

gitee store:
https://gitee.com/dcloud/uni-preset-vue/tree/vite
https://gitee .com/dcloud

uni-preset-vue-master.zip
uni-preset-vue-vite.zip
Insert image description here

Create an h5 project of uniapp offline version offline

vue create -p D:/uni-preset-vue-master my-project
Here you can specify the template directory as D:/uni-preset-vue-master

Insert image description here

There will be dependencies after downloading by default. If the dependencies are not initialized, use the following command to initialize the module dependencies:
npm install
File structure: a>
Insert image description here

run

Open the console and enter the root directory
Insert image description here
Run the command:
npm run serve

Default access address: http://localhost:8080/#/

Run using HBuilderX
Insert image description here

Package npm run build

Guess you like

Origin blog.csdn.net/qq_27577113/article/details/134627926