当前位置:网站首页>Uniapp development, packaged as H5 and deployed to the server

Uniapp development, packaged as H5 and deployed to the server

2022-07-06 00:21:00 Ma Xiaotiao's coding advanced road

Front end use uniapp After the development project is completed , Need to package the page , Generate H5 Static files for , Deploy on the server .
In this way, the server link address , You can click to access directly on your mobile phone .

The whole steps of packaging are as follows :
One 、 Click on the menu bar “ issue ”, Click Select “ Website -PC Web Or cell phone H5”,

 Insert picture description here

Two 、 Fill in the website title and website domain name / Server's IP Address .
( This address is the address where the static files are stored after the project is packaged )

 Insert picture description here

3、 ... and 、 Click to enter manifest.json Of h5 In the configuration , Configure some information according to your own situation .
Be sure to pay attention to the configuration “ The basic path of operation ”, If a blank page or static file appears 404 The situation of , It may be because this path is not configured .

 Insert picture description here

Four 、 Click release , The console compiles automatically . The following prompt appears , The compilation is successful :

 Insert picture description here

5、 ... and 、 Click on the red box in the image above , You can see the packed static page .( Just put this h5 Compress the file , Just send it to the back end )

 Insert picture description here

If you need to upload it to the server by yourself , Continue with the following steps .
6、 ... and 、 Get the address information of the server first , Find a tool , Connect to the server of the project , Go to the root directory of the server .
What I use here is ftp Tools . Create a new one under the root directory aofan Folder , Then put the... In the figure above static The folder and index.html Copy it in .
OK, At this time, the deployment has been successful .

7、 ... and 、 Open the browser , enter server ip Address , Visit index.html The content of .

Be careful : The path names of these three places must be consistent .
1: The basic running path of the configuration at the time of packaging
2: Static files are stored under the root directory of the server static and index.html
3: The access path in the browser

 Insert picture description here

原网站

版权声明
本文为[Ma Xiaotiao's coding advanced road]所创,转载请带上原文链接,感谢
https://yzsam.com/2022/187/202207060018143112.html