【微信小程序】uni-app小程序项目分包技术方案

作者:今年下半年日期:2026/10/7

微信小程序分包技术方案

一、背景与目标

  • 项目形态:uni-app + Vue3 + Vite 的小程序项目,组件库为 wot-design-uni(easycom 全局引入),另含 echarts、jsencrypt 等依赖,业务页面较多。
  • 小程序对包体积有硬性限制,页面与依赖持续增长后,若不做分包容易出现「主包超 2MB 无法上传」的问题。
  • 分包目标:把非启动、非高频的业务页面拆到分包,压缩主包体积、缩短首屏启动时间,同时通过分包预下载降低分包页面的首次进入等待。

二、微信小程序体积限制(前提)

项目限制
主包大小不超过 2MB
单个分包大小不超过 2MB
所有分包 + 主包总和不超过 20MB

超过主包 2MB 限制时,微信开发者工具会直接阻止上传,因此主包只应保留启动页、tabBar 页和高频页面。

三、当前分包现状

1. 总量

归属页面数pages.json 配置位置
主包23pages 数组
分包 pagesA39subPackages[0],root 为 pagesA
分包 pagesB18subPackages[1],root 为 pagesB
合计80—

2. 主包页面(pages 数组)

启动路由为主包第一项,即 pages/index/index。主包包含:

  • 首页与入口:pages/index/index(tabBar 页)
  • 登录相关:pages/login、pages/login-other、pages/password
  • 管理中心:pages/management/index(tabBar 页)
  • 管理中心下的高频子页:pages/management/needs(index、detail、needs-apply)、pages/management/lease(index、detail、pay-history、contract-list、contract-view)、pages/management/rent(index、rent-detail、rent-pay)

其中 tabBar 页面为 pages/index/index 与 pages/management/index,必须在主包。

3. 分包 pagesA(root: pagesA)

按业务拆分,共 39 页,包含三个模块:

  • business(业务管理):业务入口、房产档案(assetArchives)、业务执行(applys)、合同管理(contractManagement)、预警信息(warningManagement)、客户档案(customerArchives)
  • inspection(巡查管理):巡查首页、打卡签到、巡查详情、异常上报、巡查登记、异常问题、关联资产清单
  • task(任务管理):任务首页、任务详情、任务执行

4. 分包 pagesB(root: pagesB)

按「审批 + 统计 + 缴费 + 系统 + 个人管理」拆分,共 18 页:

  • audit(审批中心、审批详情)
  • statistics(数据统计,内含 charts 图表组件)
  • payment(缴费明细、历史缴费)
  • webview(VR 全景)
  • system(系统管理、信息维护、我的消息、消息详情、密码修改)
  • management(我的收藏、发票下载与开票详情、信息维护与账号/企业/用户名设置)

四、目录结构与分包映射

源码目录归属说明
src/pages主包对应 pages 数组;只有注册的页面会被编译
src/pagesA分包 pagesA对应 subPackages 中 root 为 pagesA 的配置
src/pagesB分包 pagesB对应 subPackages 中 root 为 pagesB 的配置
src/components、src/mixins、src/services、src/stores、src/utils主包公共资源主包资源分包可引用,因此公共组件/接口/工具放主包是正确的
src/static主包静态资源tabBar 图标只能使用本地图片,必须留在这里
src/uni_modules默认进主包如 lime-echart,分包若引用会一并进主包
项目根 static(README 约定)不打包单独上传后由 VITE_APP_STATIC_URL 指向,避免占用包体积

编译产物(dist/*/mp-weixin)与源码一一对应:主包页面在 pages/ 下,分包页面分别输出到 pagesA/、pagesB/ 目录,并由 app.json 的 pages / subPackages / preloadRule 描述。

五、配置说明

1. pages.json 结构

  • pages:主包页面数组,第一项为启动页;每项含 path 与 style。
  • subPackages:分包数组,每项含 root(分包根目录,相对项目根)与 pages 数组;分包页面的 path 是相对 root 的路径,不带 root 前缀。
  • preloadRule:分包预下载规则对象,键为触发页面路径,值为 { network, packages };packages 中填分包 root,__APP__ 表示主包。
  • 分包配置示意(结构与实际一致):
1"subPackages": [
2  { "root": "pagesA", "pages": [ { "path": "business/index", "style": {} } ] },
3  { "root": "pagesB", "pages": [ { "path": "system/index", "style": {} } ] }
4]
5

注意:pages.json 允许写注释(uni-app 会解析),但编译产物的 app.json 中注释会被移除。

六、注意事项(重点)

  1. tabBar 页面必须在主包:pages/index/index、pages/management/index 为 tabBar 页,不能移入分包,否则无法通过校验。
  2. 分包之间不能相互引用资源:pagesA 的页面不能 import pagesB 的组件或 JS;页面之间可以互相跳转,但资源引用只能「分包 → 主包」,不能「主包 → 分包」,也不能「分包 → 另一分包」。
  3. 公共资源应放主包:components、services、utils、stores、mixins 放主包是正确做法,分包可直接引用;反之把它们放进某个分包会导致其他分包无法使用。
  4. easycom 组件库会进主包:wot-design-uni 通过 pages.json 的 easycom 全局注册,编译产物中位于主包 node-modules 目录,会被所有分包共用,其体积直接计入主包,需控制使用范围。
  5. 第三方大依赖的归属:npm 依赖默认会被合入主包(common/vendor.js)。像 echarts 这类大依赖若只在个别页面使用,建议以「静态文件放分包目录」或「分包内按需引用」的方式规避,避免撑大主包。当前项目已把 echarts.min.js 放在 pagesB/static 下、统计页在分包内使用,方向正确。
  6. 静态资源放置位置决定归属:放在 src/static 会打进主包;放在分包 root(如 pagesB/static)下才会随分包打包;体积大的资源应走外部地址(VITE_APP_STATIC_URL)。
  7. 分包页面的路径写法:pages.json 中 path 不含 root;代码里跳转需写全路径(如 /pagesA/business/index);tabBar 页切换使用 uni.switchTab。
  8. 未注册的页面不会成为可访问页面:pages.json 中未注册的 .vue 不会被编译进包,新增页面务必同步注册,避免出现「本地有文件、线上打不开」。
  9. preloadRule 的方向与粒度:应由主包高频页预下载分包(而不是由分包页预下载主包);一个页面只配置一条规则;network 可选 all / wifi,仅在 wifi 下预下载可节省用户流量。
  10. 预下载不是免费:预下载会额外消耗流量与启动资源,只应对高频分包配置,避免一次性预下载全部分包。
  11. 分包 root 命名与层级:root 不能与主包目录重名或嵌套,也不能是另一个分包的子目录;分包页面 path 必须位于该 root 之下。
  12. 分包首次进入需下载:分包页面首次打开会有下载等待,可通过预下载、减小分包体积、首屏骨架/loading 缓解。
  13. 分包不影响条件编译:manifest 中的平台差异化配置(H5 / 小程序)与分包独立,互不干扰。
  14. 上传前的体积自检:微信开发者工具「详情 → 基本信息」可查看主包/分包体积,工具栏「代码依赖分析」可定位大文件来源;建议纳入提测/上线前的检查项。

七、验证与排查

  1. 本地编译:执行小程序构建命令(package.json 中的 build:mp-weixin)后,检查 dist 目录是否按 pages / pagesA / pagesB 正确产出。
  2. 配置核对:对比编译产物 app.json 的 pages、subPackages、preloadRule 与源码 pages.json 是否一致。
  3. 体积核对:微信开发者工具 > 详情 > 基本信息,查看主包与各分包体积是否超限。
  4. 依赖定位:微信开发者工具 > 代码依赖分析,确认大文件是否落在主包。
  5. 真机验证:分别从主包入口进入、直接进入分包页面(扫码指定页面路径),验证跳转与预下载是否正常。

附录:pages.json(完整)

1{
2  "easycom": {
3    "autoscan": true,
4    "custom": {
5      // "^uni-(.*)": "@dcloudio/uni-ui/lib/uni-$1/uni-$1.vue",
6      "^wd-(.*)": "wot-design-uni/components/wd-$1/wd-$1.vue"
7    }
8  },
9  "pages": [ //pages数组中第一项表示应用启动页,参考:https://uniapp.dcloud.io/collocation/pages
10    {
11      "path": "pages/index/index",
12      "style": {
13        "navigationStyle": "custom",
14        "navigationBarTitleText": "首页"
15      }
16    },
17    {
18      "path": "pages/login",
19      "style": {
20        "navigationStyle": "custom",
21        "navigationBarTitleText": "登录"
22      }
23    },
24    {
25      "path": "pages/login-other",
26      "style": {
27        "navigationStyle": "custom",
28        "navigationBarTitleText": "登录"
29      }
30    },
31    {
32      "path": "pages/password",
33      "style": {
34        "navigationStyle": "custom",
35        "navigationBarTitleText": "找回密码"
36      }
37    },
38    {
39      "path": "pages/index/index-company",
40      "style": {
41        "navigationBarTitleText": "公司介绍",
42        "navigationBarBackgroundColor": "#EAF7FF"
43      }
44    },
45    {
46      "path": "pages/index/index-house",
47      "style": {
48        "navigationBarTitleText": "房屋信息",
49        "navigationBarBackgroundColor": "#FFF",
50        "enablePullDownRefresh": true
51      }
52    },
53    {
54      "path": "pages/index/index-map",
55      "style": {
56        "navigationBarTitleText": "地图找地",
57        "navigationBarBackgroundColor": "#FFF"
58      }
59    },
60    {
61      "path": "pages/index/detail",
62      "style": {
63        "navigationStyle": "custom",
64        "navigationBarTitleText": "详情信息"
65      }
66    },
67    {
68      "path": "pages/message/index",
69      "style": {
70        "navigationStyle": "custom",
71        "navigationBarTitleText": "消息中心",
72        "enablePullDownRefresh": true
73      }
74    },
75    {
76      "path": "pages/message/details",
77      "style": {
78        "navigationStyle": "custom",
79        "navigationBarTitleText": "消息详情"
80      }
81    },
82    {
83      "path": "pages/management/index",
84      "style": {
85        "navigationStyle": "custom",
86        "navigationBarTitleText": "管理中心"
87      }
88    },
89
90    {
91      "path": "pages/management/needs/index",
92      "style": {
93        "navigationStyle": "custom",
94        "navigationBarTitleText": "我的需求",
95        "enablePullDownRefresh": true
96      }
97    },
98    {
99      "path": "pages/management/needs/detail",
100      "style": {
101        "navigationStyle": "custom",
102        "navigationBarTitleText": "需求详情"
103      }
104    },
105    {
106      "path": "pages/management/needs/needs-apply",
107      "style": {
108        "navigationStyle": "custom",
109        "navigationBarTitleText": "需求申请"
110      }
111    },
112    {
113      "path": "pages/management/lease/index",
114      "style": {
115        "navigationStyle": "custom",
116        "navigationBarTitleText": "我的租赁",
117        "enablePullDownRefresh": true
118      }
119    },
120    {
121      "path": "pages/management/lease/detail",
122      "style": {
123        "navigationStyle": "custom",
124        "navigationBarTitleText": "租赁详情"
125      }
126    },
127    {
128      "path": "pages/management/lease/pay-history",
129      "style": {
130        "navigationStyle": "custom",
131        "navigationBarTitleText": "历史缴费",
132        "enablePullDownRefresh": true
133      }
134    },
135    {
136      "path": "pages/management/lease/contract-list",
137      "style": {
138        "navigationStyle": "custom",
139        "navigationBarTitleText": "合同列表",
140        "enablePullDownRefresh": true
141      }
142    },
143    {
144      "path": "pages/management/lease/contract-view",
145      "style": {
146        "navigationStyle": "custom",
147        "navigationBarTitleText": "查看合同"
148      }
149    },
150    {
151      "path": "pages/management/rent/index",
152      "style": {
153        "navigationStyle": "custom",
154        "navigationBarTitleText": "租金缴纳",
155        "enablePullDownRefresh": true
156      }
157    },
158    {
159      "path": "pages/management/rent/rent-detail",
160      "style": {
161        "navigationStyle": "custom",
162        "navigationBarTitleText": "缴费详情"
163      }
164    },
165    {
166      "path": "pages/management/rent/rent-pay",
167      "style": {
168        "navigationStyle": "custom",
169        "navigationBarTitleText": "租金缴纳"
170      }
171    },
172    {
173      "path": "pages/index/topic-detail",
174      "style": {
175        "navigationStyle": "custom",
176        "navigationBarTitleText": "专题详情",
177        "enablePullDownRefresh": true
178      }
179    }
180  ],
181  // 分包配置
182  "subPackages": [{
183      "root": "pagesA",
184      "pages": [{
185          "path": "business/index",
186          "style": {
187            "navigationStyle": "custom",
188            "navigationBarTitleText": "业务管理"
189          }
190        },
191        {
192          "path": "business/assetArchives/index-house",
193          "style": {
194            "navigationBarTitleText": "房屋管理",
195            "navigationBarBackgroundColor": "#FFF",
196            "enablePullDownRefresh": true
197          }
198        },
199        {
200          "path": "business/applys/index",
201          "style": {
202            "navigationBarTitleText": "业务执行",
203            "navigationBarBackgroundColor": "#FFF",
204            "enablePullDownRefresh": true
205          }
206        },
207        {
208          "path": "business/applys/detail",
209          "style": {
210            "navigationStyle": "custom",
211            "navigationBarTitleText": "详情信息"
212          }
213        },
214        {
215          "path": "business/applys/followList",
216          "style": {
217            "navigationStyle": "custom",
218            "navigationBarTitleText": "跟进情况",
219            "enablePullDownRefresh": true
220          }
221        },
222        {
223          "path": "business/applys/followDetail",
224          "style": {
225            "navigationStyle": "custom",
226            "navigationBarTitleText": "跟进详情"
227          }
228        },
229        {
230          "path": "business/applys/followAdd",
231          "style": {
232            "navigationStyle": "custom",
233            "navigationBarTitleText": "添加跟进"
234          }
235        },
236        {
237          "path": "business/assetArchives/detail",
238          "style": {
239            "navigationStyle": "custom",
240            "navigationBarTitleText": "详情信息"
241          }
242        },
243        {
244          "path": "business/assetArchives/followUpStatus",
245          "style": {
246            "navigationStyle": "custom",
247            "navigationBarTitleText": "跟进情况",
248            "enablePullDownRefresh": true
249          }
250        },
251        {
252          "path": "business/assetArchives/contractInformation",
253          "style": {
254            "navigationStyle": "custom",
255            "navigationBarTitleText": "合同信息",
256            "enablePullDownRefresh": true
257          }
258        },
259        {
260          "path": "business/assetArchives/customerInformation",
261          "style": {
262            "navigationStyle": "custom",
263            "navigationBarTitleText": "客户信息",
264            "enablePullDownRefresh": true
265          }
266        },
267        {
268          "path": "business/contractManagement/index",
269          "style": {
270            "navigationBarTitleText": "合同管理",
271            "navigationBarBackgroundColor": "#FFF",
272            "enablePullDownRefresh": true
273          }
274        },
275        {
276          "path": "business/contractManagement/detail",
277          "style": {
278            "navigationStyle": "custom",
279            "navigationBarTitleText": "合同详情"
280          }
281        },
282        {
283          "path": "business/contractManagement/meshForm",
284          "style": {
285            "navigationStyle": "custom",
286            "navigationBarTitleText": "公示信息"
287          }
288        },
289        {
290          "path": "business/contractManagement/stampedContract",
291          "style": {
292            "navigationStyle": "custom",
293            "navigationBarTitleText": "盖章合同"
294          }
295        },
296        {
297          "path": "business/contractManagement/contractForm",
298          "style": {
299            "navigationStyle": "custom",
300            "navigationBarTitleText": "添加合同"
301          }
302        },
303        {
304          "path": "business/warningManagement/index",
305          "style": {
306            "navigationBarTitleText": "预警信息",
307            "navigationBarBackgroundColor": "#fff",
308            "enablePullDownRefresh": true
309          }
310        },
311        {
312          "path": "business/customerArchives/index",
313          "style": {
314            "navigationBarTitleText": "客户档案",
315            "enablePullDownRefresh": true
316          }
317        },
318        {
319          "path": "business/customerArchives/followUp",
320          "style": {
321            "navigationStyle": "custom",
322            "navigationBarTitleText": "跟进情况",
323            "enablePullDownRefresh": true
324          }
325        },
326        {
327          "path": "business/customerArchives/followDetail",
328          "style": {
329            "navigationStyle": "custom",
330            "navigationBarTitleText": "跟进详情"
331          }
332        },
333        {
334          "path": "business/customerArchives/customerDetail",
335          "style": {
336            "navigationStyle": "custom",
337            "navigationBarTitleText": "客户详情"
338          }
339        },
340        {
341          "path": "business/customerArchives/authentication",
342          "style": {
343            "navigationStyle": "custom",
344            "navigationBarTitleText": "客户认证"
345          }
346        },
347        {
348          "path": "business/customerArchives/customerForm",
349          "style": {
350            "navigationStyle": "custom",
351            "navigationBarTitleText": "添加客户"
352          }
353        },
354        {
355          "path": "business/customerArchives/creditEvaluation",
356          "style": {
357            "navigationStyle": "custom",
358            "navigationBarTitleText": "信用评价",
359            "enablePullDownRefresh": true
360          }
361        },
362        {
363          "path": "business/customerArchives/lease-history",
364          "style": {
365            "navigationStyle": "custom",
366            "navigationBarTitleText": "租赁历史",
367            "enablePullDownRefresh": true
368          }
369        },
370        {
371          "path": "business/customerArchives/lease-detail",
372          "style": {
373            "navigationStyle": "custom",
374            "navigationBarTitleText": "租赁详情"
375          }
376        },
377        {
378          "path": "business/customerArchives/rent-list",
379          "style": {
380            "navigationStyle": "custom",
381            "navigationBarTitleText": "缴纳情况"
382          }
383        },
384        {
385          "path": "business/customerArchives/rent-detail",
386          "style": {
387            "navigationStyle": "custom",
388            "navigationBarTitleText": "缴纳详情"
389          }
390        },
391        {
392          "path": "business/assetArchives/openMap",
393          "style": {
394            "navigationBarTitleText": "定位调整"
395          }
396        },
397        {
398          "path": "inspection/index",
399          "style": {
400            "navigationBarTitleText": "巡查管理",
401            "enablePullDownRefresh": true
402          }
403        },
404        {
405          "path": "inspection/checkIn",
406          "style": {
407            "navigationStyle": "custom",
408            "navigationBarTitleText": "打卡签到"
409          }
410        },
411        {
412          "path": "inspection/detail",
413          "style": {
414            "navigationStyle": "custom",
415            "navigationBarTitleText": "巡查信息"
416          }
417        },
418        {
419          "path": "inspection/abnormalsAdd",
420          "style": {
421            "navigationStyle": "custom",
422            "navigationBarTitleText": "异常上报"
423          }
424        },
425        {
426          "path": "inspection/executionAdd",
427          "style": {
428            "navigationStyle": "custom",
429            "navigationBarTitleText": "巡查登记"
430          }
431        },
432        {
433          "path": "inspection/abnormals-detail",
434          "style": {
435            "navigationStyle": "custom",
436            "navigationBarTitleText": "异常问题"
437          }
438        },
439        {
440          "path": "inspection/assets-list",
441          "style": {
442            "navigationStyle": "custom",
443            "navigationBarTitleText": "关联资产清单"
444          }
445        },
446        {
447          "path": "task/index",
448          "style": {
449            "navigationBarTitleText": "任务管理",
450            "enablePullDownRefresh": true
451          }
452        },
453        {
454          "path": "task/detail",
455          "style": {
456            "navigationStyle": "custom",
457            "navigationBarTitleText": "任务详情"
458          }
459        },
460        {
461          "path": "task/executionAdd",
462          "style": {
463            "navigationStyle": "custom",
464            "navigationBarTitleText": "任务执行"
465          }
466        }
467      ]
468    },
469    {
470      "root": "pagesB",
471      "pages": [{
472          "path": "audit/index",
473          "style": {
474            "navigationBarTitleText": "审批中心",
475            "enablePullDownRefresh": true
476          }
477        },
478        {
479          "path": "audit/detail",
480          "style": {
481            "navigationBarTitleText": "审批详情",
482            "enablePullDownRefresh": true
483          }
484        },
485        {
486          "path": "statistics/index",
487          "style": {
488            "navigationStyle": "custom",
489            "navigationBarTitleText": "数据统计"
490          }
491        },
492        {
493          "path": "payment/index",
494          "style": {
495            "enablePullDownRefresh": true,
496            "navigationBarTitleText": "缴费明细"
497          }
498        },
499        {
500          "path": "payment/payment-history",
501          "style": {
502            "navigationStyle": "custom",
503            "navigationBarTitleText": "历史缴费",
504            "enablePullDownRefresh": true
505          }
506        },
507        {
508          "path": "webview/index",
509          "style": {
510            "navigationBarTitleText": "VR全景"
511          }
512        },
513        {
514          "path": "system/index",
515          "style": {
516            "navigationStyle": "custom",
517            "navigationBarTitleText": "系统管理"
518          }
519        },
520        {
521          "path": "system/setting",
522          "style": {
523            "navigationStyle": "custom",
524            "navigationBarTitleText": "信息维护"
525          }
526        },
527        {
528          "path": "system/my-message",
529          "style": {
530            "navigationStyle": "custom",
531            "navigationBarTitleText": "我的消息",
532            "enablePullDownRefresh": true
533          }
534        },
535        {
536          "path": "system/my-message-details",
537          "style": {
538            "navigationStyle": "custom",
539            "navigationBarTitleText": "消息详情"
540          }
541        },
542        {
543          "path": "system/password",
544          "style": {
545            "navigationStyle": "custom",
546            "navigationBarTitleText": "密码修改"
547          }
548        },
549        {
550          "path": "management/collection/index",
551          "style": {
552            "navigationStyle": "custom",
553            "navigationBarTitleText": "我的收藏",
554            "enablePullDownRefresh": true
555          }
556        },
557        {
558          "path": "management/invoicing/invoice-view",
559          "style": {
560            "navigationStyle": "custom",
561            "navigationBarTitleText": "开票详情"
562          }
563        },
564        {
565          "path": "management/invoicing/invoice-list",
566          "style": {
567            "navigationStyle": "custom",
568            "navigationBarTitleText": "发票下载",
569            "enablePullDownRefresh": true
570          }
571        },
572        {
573          "path": "management/setting/index",
574          "style": {
575            "navigationStyle": "custom",
576            "navigationBarTitleText": "信息维护"
577          }
578        },
579        {
580          "path": "management/setting/setting-account",
581          "style": {
582            "navigationStyle": "custom",
583            "navigationBarTitleText": "账号信息"
584          }
585        },
586        {
587          "path": "management/setting/setting-company",
588          "style": {
589            "navigationStyle": "custom",
590            "navigationBarTitleText": "企业信息"
591          }
592        },
593        {
594          "path": "management/setting/setting-nickname",
595          "style": {
596            "navigationStyle": "custom",
597            "navigationBarTitleText": "设置用户名"
598          }
599        }
600      ]
601    }
602  ],
603  "preloadRule": {
604    "pagesB/system/index": {
605      "network": "all",
606      "packages": ["__APP__"]
607    }
608  },
609  "globalStyle": {
610    "navigationBarTextStyle": "black",
611    "navigationBarTitleText": "智汇资产管理系统",
612    "navigationBarBackgroundColor": "#FCFCFC",
613    "backgroundColor": "#FCFCFC"
614  },
615  "tabBar": {
616    "custom": true, // 启用自定义 TabBar
617    "color": "#626768",
618    "selectedColor": "#2253F5",
619    "borderStyle": "white",
620    "backgroundColor": "#FFF",
621    "list": [ // 使用了自定义 TabBar,原生 list 中的文本、图标等配置会被忽略,仅用于满足小程序格式校验
622      {
623        "pagePath": "pages/index/index",
624        "text": "首页",
625        "iconPath": "static/icons/tabbar/home.png",
626        "selectedIconPath": "static/icons/tabbar/home_active.png"
627      },
628      {
629        "pagePath": "pages/management/index",
630        "text": "管理中心",
631        "iconPath": "static/icons/tabbar/user.png",
632        "selectedIconPath": "static/icons/tabbar/user_active.png"
633      }
634    ]
635  },
636	"condition" : { //模式配置,仅开发期间生效
637		"current": 0, //当前激活的模式(list 的索引项)
638		"list": [
639			{
640				"name": "", //模式名称
641				"path": "", //启动页面,必选
642				"query": "" //启动参数,在页面的onLoad函数里面得到
643			}
644		]
645	}
646}
647

参考文档


《【微信小程序】uni-app小程序项目分包技术方案》 是转载文章,点击查看原文。


相关推荐


基于MediaPipe姿态估计的实时跌倒检测系统设计与实现
7zcode2026/9/29

摘要:跌倒是老年人和特殊人群面临的重大安全隐患,及时准确的跌倒检测对于保障生命安全具有重要意义。本文设计并实现了一种基于 MediaPipe 姿态估计技术的智能跌倒检测系统。 项目概览 项目简介 该系统利用 Google MediaPipe 框架提取人体关键点信息,通过分析躯干角度、身高比例等多维度特征,结合时间序列确认机制,实现对跌倒事件的准确识别。 实验结果表明,该系统能够有效区分站立、弯腰和跌倒三种姿态,通过连续 4 帧确认机制显著降低了误报率。系统具有部署简便、实时性好、准确率


Agent 写正则来实现规则 ≈ 踩坑
hpoenixf2026/9/23

最近在升级我的个人投资研究 Agent 时,我碰到了一个很容易被忽略的问题: 确定性实现,不等于客观判断。 代码当然可以稳定地执行一个正则、关键词表或布尔条件。 但“执行稳定”并不会自动赋予 Runtime 理解开放自然语言的能力。 如果 Runtime 并不知道一句话的真实语义,就不要因为能把它写成 if,假装自己知道。 这篇文章讨论的,就是 Agent 系统里一条很重要的边界: Runtime 只应该对自己真正知道、能够追溯和复核的事实负责。 前情提要:我们在做什么 Agent 我


15、音频系统
狂人开飞机2026/9/15

第15章 音频系统 15.1 AudioStreamPlayer 基础 # AudioStreamPlayer:非位置音频(BGM、UI音效) # AudioStreamPlayer2D:2D 位置音频(距离衰减) # AudioStreamPlayer3D:3D 位置音频 extends AudioStreamPlayer func _ready() -> void: stream = preload("res://audio/bgm/battle_theme.ogg")


Git-SVN 混合开发,从入门到精通!
重生之我来学Python2026/9/7

Git-SVN 混合开发:命令对照、工作流程与 15+ 实战技巧,一篇搞定! 摘要 本文详细介绍 Git-SVN 混合开发的完整方案,涵盖从安装配置到实战操作的全流程。通过 Git 命令与 SVN 命令的对照表格、15+ 个核心命令详解、以及真实场景下的工作流程,帮助你在 SVN 项目中享受 Git 的便利。无论你是被迫使用 SVN 的 Git 用户,还是想尝试 Git 功能的 SVN 团队,这篇文章都能让你快速上手 Git-SVN 混合开发模式。 在 SVN 项目中使用 Git 本地分支、暂


Highcharts 双 Y 轴分组错位柱状图・代码详解
Highcharts.js2026/8/30

双 Y 轴、非分组错位并列柱状图,同时展示两类指标: 左轴:员工数量(人数,普通数值)右轴:利润(百万美元,金额) 同一分类下 4 根柱子错开摆放,不会互相重叠,用来对比「优化前 / 优化后」两组数据差异。 示例代码 Highcharts.chart('container', { chart: { type: 'column' }, title: { text: 'Efficiency Optimization by Branch


OpenCV实战——透视变换与身份证号码模板识别
clorinda2026/8/22

一、前言》》》》》》》 在现实生活中,发票、身份证和纸张通常不是完全正对着摄像头拍摄的。由于拍摄角度不同,原本的矩形会变成梯形,文字也会发生倾斜。 如果直接对这种图片进行识别,效果往往不理想。因此,通常需要先完成透视变换,把图像矫正成正面视图,再进行二值化、轮廓检测和模板匹配。 本篇主要介绍: 1,透视变换的原理; 2,四个角点的排序; 3,发票图像矫正; 4,形态学闭运算; 5,使用模板匹配识别身份证号码。 二、透视变换的基本原理 透视变换可以把原图中的任意四边形转换成一


Rust Borrow借用详解:不转移所有权访问数据
程序员爱钓鱼2026/8/9

《Rust编程实战》系列第35篇 在上一篇文章中,我们学习了Rust的Copy,了解了哪些轻量数据类型可以在赋值或传参时自动复制。本篇继续进入Rust所有权体系中非常重要的概念: Borrow 中文通常称为“借用”。 前面我们已经知道,String、Vec等非Copy类型传递给另一个变量或函数时,通常会发生所有权移动: fn print_name(name: String) { println!("{}", name); } fn main() { let name = S


Rust图像处理第22节-从RGB到YCbCr: 让亮度和颜色分家
花褪残红青杏小2026/7/31

🦀 Rust + WASM 实战系列 第 22 篇 阅读时间:约 8 分钟 | 实战可运行 📌 写在前面 前面 21 篇,所有图像都是拿 R、G、B 三个数表示的。这一篇换一套坐标系:一个亮度 + 两个色度。 手机里的每一张照片、你看的每一个视频,存进文件之前都会先做这个转换。原因很简单:人眼对亮度极其敏感,对颜色极其迟钝,把两者分开之后,颜色那部分可以随便砍。 数学上,它就是一个 3×3 矩阵(19节的矩阵 × 向量)加它的逆矩阵(21节的 try_inverse) 🚀 TL;DR


🤯 面试被问 AI Workflow 和 Agent 有啥区别?3 张图 + 2 段代码讲清楚!
ReBound2026/7/23

🤯 面试被问 AI Workflow 和 Agent 有啥区别?3 张图 + 2 段代码讲清楚! 摘要:Workflow 和 Agent 到底有啥区别?为什么 Coze 工作流和 ReAct Agent 看起来都在"执行任务",本质却完全不同?本文从面试翻车经历出发,结合 Anthropic 官方定义、ReAct 框架、完整代码示例和实战选型指南,帮你彻底搞懂这对最容易混淆的 AI 概念。 📌 前言 上周面试,面试官笑眯眯地问了一句: "你说说 AI Workflow 和 Agent


大模型入门:从“猜词游戏“到“超级大脑“,一篇读懂 AI 大模型
修己xj2026/7/15

2023 年初,ChatGPT 横空出世,"大模型"三个字一夜之间刷爆了所有人的朋友圈。有人拿它写代码,有人拿它写情书,还有人拿它辅导孩子做数学——而且它居然真的会。 可当你真正想搞懂"大模型到底是什么"时,迎面而来的却是满屏的"Transformer""自注意力""千亿参数",瞬间劝退。 别慌。这篇文章,我们用打比方的方式,把大模型从里到外讲清楚。 一、什么是大模型?先搞懂"大"在哪 今天大家口中的大模型,通常特指大语言模型(LLM,Large Language Model)。ChatGPT

首页编辑器站点地图

本站内容在 CC BY-SA 4.0 协议下发布

Copyright © 2026 聚合阅读