当前位置:网站首页>Subcontracting of wechat applet based on uni app
Subcontracting of wechat applet based on uni app
2022-04-23 21:23:00 【Sister Chunfeng】
About subcontracting
The specified applet cannot exceed 2M, Once exceeded, subcontracting is required
matters needing attention
subPackages Inside pages The path is root Next relative path , Not a full path .
The size of each package of wechat applet is 2M, The total volume cannot exceed 16M.
The size of each subcontract of Baidu applet is 2M, The total volume cannot exceed 8M.
The size of each subpackage of Alipay applet is 2M, The total volume cannot exceed 4M.
QQ The size of each package of the applet is 2M, The total volume cannot exceed 24M.
Independent services are supported under subcontracting static Catalog , Used to subcontract static resources .
uni-app Support for wechat applet 、QQ Applet 、 Baidu applet subcontracting optimization , About static resources or js The file is put into the subcontract and does not occupy the size of the main package . Please refer to : Description of subcontract optimization
in the light of vendor.js If it is too large, you can use runtime compression code
HBuilderX Check run... For the created item –> Run to the applet Simulator –> Whether the runtime compresses the code
cli The project created can be in pacakge.json Add parameters in –minimize, Example :“dev:mp-weixin”: “cross-env NODE_ENV=development UNI_PLATFORM=mp-weixin vue-cli-service uni-build --watch --minimize”
Usage method
First you have to have one uniapp Wechat applet project of
Let's say you have , Original project structure
Open it with wechat development tool , Before subcontracting
stay pages Create subcontracting at the same level
pages.json To configure
so what , The official website supports it Subcontract optimization
Add... Under the configuration of the corresponding platform "optimization":{“subPackages”:true} Turn on subcontracting optimization
Currently only supported mp-weixin、mp-qq、mp-baidu Optimization of subcontracting
Specific logic of subcontract optimization :
Static files : Subcontract support static And other static resource copies , That is, static resources placed in the subcontract directory will not be packaged into the main package , It can't be used in the main package
js file : When a js When referenced by only one subcontract , The js Will be packed into the subcontract , Otherwise, it still hits the main package ( It is referenced by the main package , Or be surpassed 1 Subcontracting references )
Custom components : If a custom component is referenced by only one subcontract , And not put into the subcontract , Compile time will output prompt information
My understanding is that , Now that you subcontract the function modules , You can score the corresponding static resources , When using pictures, it is directly the path under subcontracting , This is a complete subcontracting .
Here I take wechat applet as an example ,
How to jump ?
Just click where you need to jump
uni.navigateTo({
url: '/myPackageA/pages/piece/piece'
})
Then restart the wechat development tool to run
You can see that the subcontracting has been successful
版权声明
本文为[Sister Chunfeng]所创,转载请带上原文链接,感谢
https://yzsam.com/2022/110/202204200620164308.html
边栏推荐
- 2. Finishing huazi Mianjing -- 2
- Introduce structured concurrency and release swift 5.5!
- Rust更适合经验较少的程序员?
- [leetcode refers to offer 18. Delete the node of the linked list (simple)]
- Deno 1.13.2 发布
- Pytorch selects the first k maximum (minimum) values and their indexes in the data
- Selenium 显示等待WebDriverWait
- 41. 缺失的第一个正数
- 3-5 obtaining cookies through XSS and the use of XSS background management system
- Deep understanding of modern mobile GPU (continuously updating)
猜你喜欢
3-5通过XSS获取cookie以及XSS后台管理系统的使用
[leetcode refers to offer 42. Maximum sum of continuous subarrays (simple)]
Google 尝试在 Chrome 中使用 Rust
Pipes and xargs
Yolov5 NMS source code understanding
Google tries to use rust in Chrome
C, print the source program of beautiful bell triangle
Arm architecture assembly instructions, registers and some problems
小米手机全球已舍弃“MI”品牌,全面改用“xiaomi”全称品牌
Deep analysis of C language pointer (Part I)
随机推荐
中创存储|想要一个好用的分布式存储云盘,到底该怎么选
setInterval、setTimeout、requestAnimationFrame
Leetcode-279-complete square number
Thread safe sigleton (singleton mode)
Deno 1.13.2 发布
Deep analysis of C language pointer (Part I)
Question brushing plan - depth first search (II)
Chrome 94 引入具有争议的 Idle Detection API,苹果和Mozilla反对
Yolov5 NMS source code understanding
Pytorch selects the first k maximum (minimum) values and their indexes in the data
Detectron2 using custom datasets
The more you use the computer, the slower it will be? Recovery method of file accidental deletion
Reentrant function
Sequential state
ros功能包内自定义消息引用失败
Realrange, reduce, repeat and einops in einops package layers. Rearrange and reduce in torch. Processing methods of high-dimensional data
Graph traversal - BFS, DFS
危机即机遇,远程办公效率为何会提升?
Pytorch: runtimeerror: an attempt has been made to start a new process Error reporting (resolved)
[leetcode refers to offer 10 - I. Fibonacci sequence (simple)]