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
background The popularity of Docker is closely re...
Table of contents Preface: 1. Create a project wi...
In MySQL, create a new table with three fields, i...
#1. Download # #2. Unzip to local and modify nece...
Table of contents What is virtual dom? Why do we ...
A hyperlink URL in Vm needs to be concatenated wit...
CSS3 can create animations, which can replace man...
Preface Recently I encountered a requirement, whi...
Table of contents 1. What is lazy loading? 2. Imp...
need After the user fills out the form and clicks...
name Specify a name for the tag. Format <input...
This article describes the MySQL user rights mana...
This article shares the specific code of node+soc...
The table is as follows: Code when Unity reads an...
1. First, double-click the vmware icon on the com...