1. Mini Program SubcontractingEach applet that uses sub-packages must contain a main package . The so-called main package is where the default startup page/TabBar page is placed, as well as some common resources/JS scripts required by all sub-packages; and the sub-packages are divided according to the developer's configuration. When the mini program is started, the main package will be downloaded by default and the page in the main package will be started. When the user enters a page in a sub-package, the client will download the corresponding sub-package and display it after the download is complete. Currently, the size of a Mini Program subpackage is subject to the following restrictions:
Subpackaging the mini program can optimize the download time when the mini program is first launched, and can better decouple collaboration when multiple teams are jointly developing. Click here to watch the official subpackaging tutorial, which is easy to understand 2. Uniapp subcontracting appletThe default for App is the whole package. Compatible with the sub-package configuration of mini-programs. Its purpose is not to speed up downloading, but to speed up startup when the home page is vue. This is the directory structure after I subpackaged the applet
Subcontracting steps:1. Configure manifest.json"mp-weixin": { "optimization":{"subPackages":true} } Optimize subcontracting: Add Currently only supports the sub-packet optimization of
2. Configure pages.jsonCreate a new array "subPackages" in pages.json. The array contains two parameters: 1.root: the root directory of the subpackage, 2.pages: which pages the subpackage consists of, the parameters are the same as pages; Note: The main package and sub-package cannot be in the same directory. When building a uniapp project, you can consider the directory structure to facilitate sub-packages later; 3. Subpackage preload configuration (preloadRule)This step is mainly for speed optimization. If you don't want to optimize the speed, you can skip this configuration. After configuring preloadRule, when entering a certain page of the mini program, the framework will automatically pre-download the sub-packages that may be needed, which will improve the startup speed when entering the subsequent sub-package pages. In
App subpackaging also supports preloadRule, but network rules are invalid. example: Finally, click to enter the uniapp official document to view the configuration items This is the end of this article about teaching you step by step about uniapp and mini program subcontracting (with pictures and text). For more relevant content about uniapp and mini program subcontracting, please search for previous articles on 123WORDPRESS.COM or continue to browse the related articles below. I hope everyone will support 123WORDPRESS.COM in the future! You may also be interested in:
|
<<: CentOS uses expect to remotely execute scripts and commands in batches
>>: Analysis of MySQL data backup and recovery implementation methods
In many cases, large and medium-sized websites wi...
HTML5 is the next version of the HTML standard. M...
Preface To put it simply, tcpdump is a packet ana...
Table of contents 1. JavaScript Objects 1).Array ...
1. Virtual environment follows the project, creat...
Table of contents 1. List traversal 2. The role o...
MariaDB database management system is a branch of...
Generic load/write methods Manually specify optio...
Table of contents Vue first screen performance op...
A few days ago, I discovered that my website was ...
1. This is a bit complicated to understand, I hop...
What is Redis Cluster Redis cluster is a distribu...
Table of contents 1. Vertical (longitudinal) slic...
Readonly and Disabled both prevent users from chan...
mysql permissions and indexes The highest user of...