[{"data":1,"prerenderedAt":3152},["ShallowReactive",2],{"article-/topics/nuxt/nuxt-composables-best-practices":3,"related-nuxt":484,"content-query-oC6aaow8I4":2789},{"_path":4,"_dir":5,"_draft":6,"_partial":6,"_locale":7,"title":8,"description":9,"date":10,"topic":5,"author":11,"tags":12,"image":18,"imageQuery":19,"pexelsPhotoId":20,"pexelsUrl":21,"featured":6,"readingTime":22,"body":23,"_type":478,"_id":479,"_source":480,"_file":481,"_stem":482,"_extension":483},"/topics/nuxt/nuxt-composables-best-practices","nuxt",false,"","Nuxt 组合式函数最佳实践：从抽离复用到边界治理","系统讲解 Nuxt 项目中 composables 的设计原则、拆分策略、状态边界与常见反模式，帮助团队把复用能力沉淀成可维护资产，而不是隐藏复杂度的“黑盒函数”。","2026-04-12","HTMLPAGE 团队",[13,14,15,16,17],"Nuxt","Composables","Vue","Architecture","Maintainability","/images/topics/nuxt/nuxt-composables-best-practices.jpg","frontend developer coding vue javascript on laptop",34803985,"https://www.pexels.com/photo/laptop-with-code-editor-displaying-programming-code-34803985/",15,{"type":24,"children":25,"toc":465},"root",[26,34,40,45,49,55,60,80,85,103,106,112,117,136,141,144,150,250,255,258,264,269,287,292,295,301,306,336,341,344,350,373,378,381,387,415,418,424,429,434],{"type":27,"tag":28,"props":29,"children":31},"element","h2",{"id":30},"nuxt-组合式函数最佳实践从抽离复用到边界治理",[32],{"type":33,"value":8},"text",{"type":27,"tag":35,"props":36,"children":37},"p",{},[38],{"type":33,"value":39},"Nuxt 的 composables 是提升复用效率的核心能力，但很多项目在“抽离逻辑”过程中，会逐步演变成另一个问题：复杂度从页面文件移动到了 composable 黑盒里，团队理解成本并没有下降。",{"type":27,"tag":35,"props":41,"children":42},{},[43],{"type":33,"value":44},"优秀的 composable 不是“代码更少”，而是“边界更清楚、行为更可预期”。",{"type":27,"tag":46,"props":47,"children":48},"hr",{},[],{"type":27,"tag":28,"props":50,"children":52},{"id":51},"_1-先明确-composable-的职责",[53],{"type":33,"value":54},"1. 先明确 composable 的职责",{"type":27,"tag":35,"props":56,"children":57},{},[58],{"type":33,"value":59},"更适合放进 composable 的内容：",{"type":27,"tag":61,"props":62,"children":63},"ul",{},[64,70,75],{"type":27,"tag":65,"props":66,"children":67},"li",{},[68],{"type":33,"value":69},"可复用的状态与行为组合",{"type":27,"tag":65,"props":71,"children":72},{},[73],{"type":33,"value":74},"与业务域相关的通用流程",{"type":27,"tag":65,"props":76,"children":77},{},[78],{"type":33,"value":79},"对外部能力的轻量封装",{"type":27,"tag":35,"props":81,"children":82},{},[83],{"type":33,"value":84},"不建议放入：",{"type":27,"tag":61,"props":86,"children":87},{},[88,93,98],{"type":27,"tag":65,"props":89,"children":90},{},[91],{"type":33,"value":92},"大量页面专属一次性逻辑",{"type":27,"tag":65,"props":94,"children":95},{},[96],{"type":33,"value":97},"与 UI 紧耦合的细节",{"type":27,"tag":65,"props":99,"children":100},{},[101],{"type":33,"value":102},"无法测试和复用的临时代码",{"type":27,"tag":46,"props":104,"children":105},{},[],{"type":27,"tag":28,"props":107,"children":109},{"id":108},"_2-设计时先画边界再写代码",[110],{"type":33,"value":111},"2. 设计时先画边界，再写代码",{"type":27,"tag":35,"props":113,"children":114},{},[115],{"type":33,"value":116},"建议从这三个问题开始：",{"type":27,"tag":118,"props":119,"children":120},"ol",{},[121,126,131],{"type":27,"tag":65,"props":122,"children":123},{},[124],{"type":33,"value":125},"这个 composable 面向哪些调用方",{"type":27,"tag":65,"props":127,"children":128},{},[129],{"type":33,"value":130},"它的输入输出契约是什么",{"type":27,"tag":65,"props":132,"children":133},{},[134],{"type":33,"value":135},"它是否会持有跨页面生命周期状态",{"type":27,"tag":35,"props":137,"children":138},{},[139],{"type":33,"value":140},"提前回答这三点，能避免“越用越重”的复用陷阱。",{"type":27,"tag":46,"props":142,"children":143},{},[],{"type":27,"tag":28,"props":145,"children":147},{"id":146},"_3-常见拆分模式",[148],{"type":33,"value":149},"3. 常见拆分模式",{"type":27,"tag":151,"props":152,"children":153},"table",{},[154,178],{"type":27,"tag":155,"props":156,"children":157},"thead",{},[158],{"type":27,"tag":159,"props":160,"children":161},"tr",{},[162,168,173],{"type":27,"tag":163,"props":164,"children":165},"th",{},[166],{"type":33,"value":167},"模式",{"type":27,"tag":163,"props":169,"children":170},{},[171],{"type":33,"value":172},"用途",{"type":27,"tag":163,"props":174,"children":175},{},[176],{"type":33,"value":177},"示例",{"type":27,"tag":179,"props":180,"children":181},"tbody",{},[182,206,228],{"type":27,"tag":159,"props":183,"children":184},{},[185,191,196],{"type":27,"tag":186,"props":187,"children":188},"td",{},[189],{"type":33,"value":190},"场景型 composable",{"type":27,"tag":186,"props":192,"children":193},{},[194],{"type":33,"value":195},"封装一条完整业务流程",{"type":27,"tag":186,"props":197,"children":198},{},[199],{"type":27,"tag":200,"props":201,"children":203},"code",{"className":202},[],[204],{"type":33,"value":205},"useCheckoutFlow",{"type":27,"tag":159,"props":207,"children":208},{},[209,214,219],{"type":27,"tag":186,"props":210,"children":211},{},[212],{"type":33,"value":213},"能力型 composable",{"type":27,"tag":186,"props":215,"children":216},{},[217],{"type":33,"value":218},"封装单一能力",{"type":27,"tag":186,"props":220,"children":221},{},[222],{"type":27,"tag":200,"props":223,"children":225},{"className":224},[],[226],{"type":33,"value":227},"useClipboard",{"type":27,"tag":159,"props":229,"children":230},{},[231,236,241],{"type":27,"tag":186,"props":232,"children":233},{},[234],{"type":33,"value":235},"数据型 composable",{"type":27,"tag":186,"props":237,"children":238},{},[239],{"type":33,"value":240},"封装获取与缓存策略",{"type":27,"tag":186,"props":242,"children":243},{},[244],{"type":27,"tag":200,"props":245,"children":247},{"className":246},[],[248],{"type":33,"value":249},"useArticleList",{"type":27,"tag":35,"props":251,"children":252},{},[253],{"type":33,"value":254},"模式清晰后，目录结构和命名会自然稳定。",{"type":27,"tag":46,"props":256,"children":257},{},[],{"type":27,"tag":28,"props":259,"children":261},{"id":260},"_4-失败案例一个-composable-同时处理请求权限ui-与埋点",[262],{"type":33,"value":263},"4. 失败案例：一个 composable 同时处理请求、权限、UI 与埋点",{"type":27,"tag":35,"props":265,"children":266},{},[267],{"type":33,"value":268},"这种“大一统 composable”短期很方便，长期会出现：",{"type":27,"tag":61,"props":270,"children":271},{},[272,277,282],{"type":27,"tag":65,"props":273,"children":274},{},[275],{"type":33,"value":276},"调用方无法复用局部能力",{"type":27,"tag":65,"props":278,"children":279},{},[280],{"type":33,"value":281},"修改一个逻辑影响多个页面",{"type":27,"tag":65,"props":283,"children":284},{},[285],{"type":33,"value":286},"测试粒度过粗，定位困难",{"type":27,"tag":35,"props":288,"children":289},{},[290],{"type":33,"value":291},"可复用不等于可维护。可维护来自合理拆分。",{"type":27,"tag":46,"props":293,"children":294},{},[],{"type":27,"tag":28,"props":296,"children":298},{"id":297},"_5-与-nuxt-生态协同的关键点",[299],{"type":33,"value":300},"5. 与 Nuxt 生态协同的关键点",{"type":27,"tag":35,"props":302,"children":303},{},[304],{"type":33,"value":305},"在 Nuxt 中，composable 通常会和这些机制协同：",{"type":27,"tag":61,"props":307,"children":308},{},[309,326,331],{"type":27,"tag":65,"props":310,"children":311},{},[312,318,320],{"type":27,"tag":200,"props":313,"children":315},{"className":314},[],[316],{"type":33,"value":317},"useAsyncData",{"type":33,"value":319}," / ",{"type":27,"tag":200,"props":321,"children":323},{"className":322},[],[324],{"type":33,"value":325},"useFetch",{"type":27,"tag":65,"props":327,"children":328},{},[329],{"type":33,"value":330},"runtime config",{"type":27,"tag":65,"props":332,"children":333},{},[334],{"type":33,"value":335},"全局状态与 Pinia",{"type":27,"tag":35,"props":337,"children":338},{},[339],{"type":33,"value":340},"要避免在 composable 里隐式读取过多全局依赖，否则会让调用方难以预测行为。",{"type":27,"tag":46,"props":342,"children":343},{},[],{"type":27,"tag":28,"props":345,"children":347},{"id":346},"_6-团队规范建议",[348],{"type":33,"value":349},"6. 团队规范建议",{"type":27,"tag":61,"props":351,"children":352},{},[353,358,363,368],{"type":27,"tag":65,"props":354,"children":355},{},[356],{"type":33,"value":357},"命名体现业务意图，而非实现细节",{"type":27,"tag":65,"props":359,"children":360},{},[361],{"type":33,"value":362},"输入参数尽量显式，减少隐式上下文依赖",{"type":27,"tag":65,"props":364,"children":365},{},[366],{"type":33,"value":367},"关键 composable 维护最小示例与契约说明",{"type":27,"tag":65,"props":369,"children":370},{},[371],{"type":33,"value":372},"在 code review 中审查“边界清晰度”",{"type":27,"tag":35,"props":374,"children":375},{},[376],{"type":33,"value":377},"这会显著提升多人协作下的稳定性。",{"type":27,"tag":46,"props":379,"children":380},{},[],{"type":27,"tag":28,"props":382,"children":384},{"id":383},"_7-checklist你的-composable-是否健康",[385],{"type":33,"value":386},"7. Checklist：你的 composable 是否健康",{"type":27,"tag":61,"props":388,"children":389},{},[390,395,400,405,410],{"type":27,"tag":65,"props":391,"children":392},{},[393],{"type":33,"value":394},"职责是否单一且可解释",{"type":27,"tag":65,"props":396,"children":397},{},[398],{"type":33,"value":399},"输入输出是否明确",{"type":27,"tag":65,"props":401,"children":402},{},[403],{"type":33,"value":404},"是否避免隐藏全局副作用",{"type":27,"tag":65,"props":406,"children":407},{},[408],{"type":33,"value":409},"是否可被独立测试",{"type":27,"tag":65,"props":411,"children":412},{},[413],{"type":33,"value":414},"是否在多个场景中复用而非只在单页使用",{"type":27,"tag":46,"props":416,"children":417},{},[],{"type":27,"tag":28,"props":419,"children":421},{"id":420},"_8-结论",[422],{"type":33,"value":423},"8. 结论",{"type":27,"tag":35,"props":425,"children":426},{},[427],{"type":33,"value":428},"Nuxt composable 的价值在于把复用变成资产，而不是把复杂度藏起来。以边界治理为核心来设计，才能在项目增长后仍保持可读、可改、可验证。",{"type":27,"tag":35,"props":430,"children":431},{},[432],{"type":33,"value":433},"进一步阅读：",{"type":27,"tag":61,"props":435,"children":436},{},[437,447,456],{"type":27,"tag":65,"props":438,"children":439},{},[440],{"type":27,"tag":441,"props":442,"children":444},"a",{"href":443},"/topics/nuxt/nuxt-data-fetching-guide",[445],{"type":33,"value":446},"Nuxt Data Fetching 指南",{"type":27,"tag":65,"props":448,"children":449},{},[450],{"type":27,"tag":441,"props":451,"children":453},{"href":452},"/topics/nuxt/nuxt-server-routes-complete-guide",[454],{"type":33,"value":455},"Nuxt Server Routes 完整指南",{"type":27,"tag":65,"props":457,"children":458},{},[459],{"type":27,"tag":441,"props":460,"children":462},{"href":461},"/topics/frontend/pinia-advanced-state-management-techniques",[463],{"type":33,"value":464},"Pinia 高级状态管理技巧",{"title":7,"searchDepth":466,"depth":466,"links":467},3,[468,470,471,472,473,474,475,476,477],{"id":30,"depth":469,"text":8},2,{"id":51,"depth":469,"text":54},{"id":108,"depth":469,"text":111},{"id":146,"depth":469,"text":149},{"id":260,"depth":469,"text":263},{"id":297,"depth":469,"text":300},{"id":346,"depth":469,"text":349},{"id":383,"depth":469,"text":386},{"id":420,"depth":469,"text":423},"markdown","content:topics:nuxt:nuxt-composables-best-practices.md","content","topics/nuxt/nuxt-composables-best-practices.md","topics/nuxt/nuxt-composables-best-practices","md",[485,1471,2249],{"_path":486,"_dir":5,"_draft":6,"_partial":6,"_locale":7,"title":487,"description":488,"date":489,"topic":5,"author":11,"tags":490,"image":496,"featured":497,"readingTime":498,"body":499,"_type":478,"_id":1468,"_source":480,"_file":1469,"_stem":1470,"_extension":483},"/topics/nuxt/nitro-engine-deep-dive","Nitro 引擎深度剖析","讲透 Nuxt/Nitro 的运行时模型、路由与中间件、存储层与缓存、部署适配与性能调优，帮助你把服务端能力当成可控的工程系统。","2026-01-20",[13,491,492,493,494,495],"Nitro","SSR","Serverless","Edge","缓存","/images/topics/nuxt/nitro.jpg",true,21,{"type":24,"children":500,"toc":1436},[501,506,519,524,582,587,592,595,601,606,629,634,652,655,661,666,689,694,697,719,731,749,760,773,779,802,805,811,816,847,852,865,868,874,886,899,904,922,927,940,943,949,954,972,978,997,1003,1008,1013,1042,1045,1051,1056,1074,1079,1097,1103,1116,1122,1135,1141,1154,1159,1172,1175,1181,1187,1200,1206,1219,1225,1238,1241,1247,1252,1275,1280,1293,1296,1302,1307,1365,1370,1388,1391,1396,1408,1413],{"type":27,"tag":28,"props":502,"children":504},{"id":503},"nitro-引擎深度剖析",[505],{"type":33,"value":487},{"type":27,"tag":35,"props":507,"children":508},{},[509,511,517],{"type":33,"value":510},"在 Nuxt 3/4 的体系里，Nitro 不是“一个服务器”，而是一套",{"type":27,"tag":512,"props":513,"children":514},"strong",{},[515],{"type":33,"value":516},"可移植的服务端运行时与构建产物规范",{"type":33,"value":518},"。",{"type":27,"tag":35,"props":520,"children":521},{},[522],{"type":33,"value":523},"它把你在开发时写的：",{"type":27,"tag":61,"props":525,"children":526},{},[527,538,549,560,571],{"type":27,"tag":65,"props":528,"children":529},{},[530,536],{"type":27,"tag":200,"props":531,"children":533},{"className":532},[],[534],{"type":33,"value":535},"server/api/*",{"type":33,"value":537},"（API 路由）",{"type":27,"tag":65,"props":539,"children":540},{},[541,547],{"type":27,"tag":200,"props":542,"children":544},{"className":543},[],[545],{"type":33,"value":546},"server/routes/*",{"type":33,"value":548},"（更底层路由）",{"type":27,"tag":65,"props":550,"children":551},{},[552,558],{"type":27,"tag":200,"props":553,"children":555},{"className":554},[],[556],{"type":33,"value":557},"server/middleware/*",{"type":33,"value":559},"（中间件）",{"type":27,"tag":65,"props":561,"children":562},{},[563,569],{"type":27,"tag":200,"props":564,"children":566},{"className":565},[],[567],{"type":33,"value":568},"server/plugins/*",{"type":33,"value":570},"（启动插件）",{"type":27,"tag":65,"props":572,"children":573},{},[574,580],{"type":27,"tag":200,"props":575,"children":577},{"className":576},[],[578],{"type":33,"value":579},"storage",{"type":33,"value":581},"（KV/文件/内存等存储抽象）",{"type":27,"tag":35,"props":583,"children":584},{},[585],{"type":33,"value":586},"统一编译成一个可以部署到多种环境的产物：Node Server、Serverless、Edge（取决于适配器与能力集）。",{"type":27,"tag":35,"props":588,"children":589},{},[590],{"type":33,"value":591},"这篇文章按“你要在生产上稳定运行”的视角，拆解 Nitro 的关键构件，并给出性能与可观测性落地建议。",{"type":27,"tag":46,"props":593,"children":594},{},[],{"type":27,"tag":28,"props":596,"children":598},{"id":597},"_1-nitro-的定位从-nuxt-ssr-到通用服务端运行时",[599],{"type":33,"value":600},"1. Nitro 的定位：从 Nuxt SSR 到“通用服务端运行时”",{"type":27,"tag":35,"props":602,"children":603},{},[604],{"type":33,"value":605},"Nitro 解决两类问题：",{"type":27,"tag":118,"props":607,"children":608},{},[609,619],{"type":27,"tag":65,"props":610,"children":611},{},[612,617],{"type":27,"tag":512,"props":613,"children":614},{},[615],{"type":33,"value":616},"运行时统一",{"type":33,"value":618},"：开发/生产环境一致的请求处理模型",{"type":27,"tag":65,"props":620,"children":621},{},[622,627],{"type":27,"tag":512,"props":623,"children":624},{},[625],{"type":33,"value":626},"部署可移植",{"type":33,"value":628},"：同一套代码可输出到不同部署目标",{"type":27,"tag":35,"props":630,"children":631},{},[632],{"type":33,"value":633},"你可以把 Nitro 看作 Nuxt 的“服务端内核”，而 Nuxt 只是围绕它提供：",{"type":27,"tag":61,"props":635,"children":636},{},[637,642,647],{"type":27,"tag":65,"props":638,"children":639},{},[640],{"type":33,"value":641},"视图渲染（SSR/RSC 相关能力）",{"type":27,"tag":65,"props":643,"children":644},{},[645],{"type":33,"value":646},"资源构建（Vite/Webpack）",{"type":27,"tag":65,"props":648,"children":649},{},[650],{"type":33,"value":651},"路由与数据获取的上层抽象",{"type":27,"tag":46,"props":653,"children":654},{},[],{"type":27,"tag":28,"props":656,"children":658},{"id":657},"_2-请求生命周期一次请求在-nitro-里怎么走",[659],{"type":33,"value":660},"2. 请求生命周期：一次请求在 Nitro 里怎么走？",{"type":27,"tag":35,"props":662,"children":663},{},[664],{"type":33,"value":665},"简化后的请求链路：",{"type":27,"tag":118,"props":667,"children":668},{},[669,674,679,684],{"type":27,"tag":65,"props":670,"children":671},{},[672],{"type":33,"value":673},"入口适配器接收请求（Node/Serverless/Edge）",{"type":27,"tag":65,"props":675,"children":676},{},[677],{"type":33,"value":678},"进入 Nitro 的 H3 请求处理器（统一事件模型）",{"type":27,"tag":65,"props":680,"children":681},{},[682],{"type":33,"value":683},"依次执行：中间件 → 路由匹配 → handler",{"type":27,"tag":65,"props":685,"children":686},{},[687],{"type":33,"value":688},"写回响应（含 headers、缓存策略、流式输出等）",{"type":27,"tag":35,"props":690,"children":691},{},[692],{"type":33,"value":693},"关键点：Nitro 用统一的事件对象承载请求上下文，这让你在不同部署目标下写出的 server 代码保持一致。",{"type":27,"tag":46,"props":695,"children":696},{},[],{"type":27,"tag":28,"props":698,"children":700},{"id":699},"_3-路由系统serverapi-与-serverroutes-的区别",[701,703,709,711,717],{"type":33,"value":702},"3. 路由系统：",{"type":27,"tag":200,"props":704,"children":706},{"className":705},[],[707],{"type":33,"value":708},"server/api",{"type":33,"value":710}," 与 ",{"type":27,"tag":200,"props":712,"children":714},{"className":713},[],[715],{"type":33,"value":716},"server/routes",{"type":33,"value":718}," 的区别",{"type":27,"tag":720,"props":721,"children":723},"h3",{"id":722},"_31-serverapi",[724,726],{"type":33,"value":725},"3.1 ",{"type":27,"tag":200,"props":727,"children":729},{"className":728},[],[730],{"type":33,"value":535},{"type":27,"tag":61,"props":732,"children":733},{},[734,739,744],{"type":27,"tag":65,"props":735,"children":736},{},[737],{"type":33,"value":738},"面向 API 的约定式目录",{"type":27,"tag":65,"props":740,"children":741},{},[742],{"type":33,"value":743},"通常返回 JSON",{"type":27,"tag":65,"props":745,"children":746},{},[747],{"type":33,"value":748},"与 Nuxt 的开发体验高度整合",{"type":27,"tag":720,"props":750,"children":752},{"id":751},"_32-serverroutes",[753,755],{"type":33,"value":754},"3.2 ",{"type":27,"tag":200,"props":756,"children":758},{"className":757},[],[759],{"type":33,"value":546},{"type":27,"tag":61,"props":761,"children":762},{},[763,768],{"type":27,"tag":65,"props":764,"children":765},{},[766],{"type":33,"value":767},"更底层，更贴近“HTTP 路由”",{"type":27,"tag":65,"props":769,"children":770},{},[771],{"type":33,"value":772},"更适合做：Webhook、回调、代理、特殊 content-type",{"type":27,"tag":720,"props":774,"children":776},{"id":775},"_33-实践建议",[777],{"type":33,"value":778},"3.3 实践建议",{"type":27,"tag":61,"props":780,"children":781},{},[782,792],{"type":27,"tag":65,"props":783,"children":784},{},[785,787],{"type":33,"value":786},"普通业务 API：优先 ",{"type":27,"tag":200,"props":788,"children":790},{"className":789},[],[791],{"type":33,"value":708},{"type":27,"tag":65,"props":793,"children":794},{},[795,797],{"type":33,"value":796},"需要更强控制（stream、代理、非 JSON）：用 ",{"type":27,"tag":200,"props":798,"children":800},{"className":799},[],[801],{"type":33,"value":716},{"type":27,"tag":46,"props":803,"children":804},{},[],{"type":27,"tag":28,"props":806,"children":808},{"id":807},"_4-中间件全局逻辑的正确放置",[809],{"type":33,"value":810},"4. 中间件：全局逻辑的正确放置",{"type":27,"tag":35,"props":812,"children":813},{},[814],{"type":33,"value":815},"Nitro 中的中间件通常用于：",{"type":27,"tag":61,"props":817,"children":818},{},[819,824,837,842],{"type":27,"tag":65,"props":820,"children":821},{},[822],{"type":33,"value":823},"鉴权/鉴别请求来源",{"type":27,"tag":65,"props":825,"children":826},{},[827,829,835],{"type":33,"value":828},"注入 ",{"type":27,"tag":200,"props":830,"children":832},{"className":831},[],[833],{"type":33,"value":834},"requestId",{"type":33,"value":836},"、trace 信息",{"type":27,"tag":65,"props":838,"children":839},{},[840],{"type":33,"value":841},"统一错误处理与日志",{"type":27,"tag":65,"props":843,"children":844},{},[845],{"type":33,"value":846},"基础安全 headers",{"type":27,"tag":35,"props":848,"children":849},{},[850],{"type":33,"value":851},"一个推荐的中间件职责边界：",{"type":27,"tag":61,"props":853,"children":854},{},[855,860],{"type":27,"tag":65,"props":856,"children":857},{},[858],{"type":33,"value":859},"中间件只做“横切关注点”",{"type":27,"tag":65,"props":861,"children":862},{},[863],{"type":33,"value":864},"不做具体业务（避免耦合与隐式依赖）",{"type":27,"tag":46,"props":866,"children":867},{},[],{"type":27,"tag":28,"props":869,"children":871},{"id":870},"_5-storage-抽象让缓存与数据存取可替换",[872],{"type":33,"value":873},"5. Storage 抽象：让缓存与数据存取可替换",{"type":27,"tag":35,"props":875,"children":876},{},[877,879,884],{"type":33,"value":878},"Nitro 的一个被低估的能力是 ",{"type":27,"tag":200,"props":880,"children":882},{"className":881},[],[883],{"type":33,"value":579},{"type":33,"value":885},"：",{"type":27,"tag":61,"props":887,"children":888},{},[889,894],{"type":27,"tag":65,"props":890,"children":891},{},[892],{"type":33,"value":893},"提供 KV 风格 API",{"type":27,"tag":65,"props":895,"children":896},{},[897],{"type":33,"value":898},"可接入内存、文件、Redis 等（取决于配置与环境）",{"type":27,"tag":35,"props":900,"children":901},{},[902],{"type":33,"value":903},"你可以用它做：",{"type":27,"tag":61,"props":905,"children":906},{},[907,912,917],{"type":27,"tag":65,"props":908,"children":909},{},[910],{"type":33,"value":911},"缓存（页面片段、API 结果）",{"type":27,"tag":65,"props":913,"children":914},{},[915],{"type":33,"value":916},"限流计数器",{"type":27,"tag":65,"props":918,"children":919},{},[920],{"type":33,"value":921},"临时会话信息",{"type":27,"tag":35,"props":923,"children":924},{},[925],{"type":33,"value":926},"设计原则：",{"type":27,"tag":61,"props":928,"children":929},{},[930,935],{"type":27,"tag":65,"props":931,"children":932},{},[933],{"type":33,"value":934},"把 storage 当成“可失效缓存”，不要当主数据库",{"type":27,"tag":65,"props":936,"children":937},{},[938],{"type":33,"value":939},"明确 TTL 与清理策略",{"type":27,"tag":46,"props":941,"children":942},{},[],{"type":27,"tag":28,"props":944,"children":946},{"id":945},"_6-缓存策略把快变成可控的工程能力",[947],{"type":33,"value":948},"6. 缓存策略：把“快”变成可控的工程能力",{"type":27,"tag":35,"props":950,"children":951},{},[952],{"type":33,"value":953},"Nitro 里的缓存往往涉及三层：",{"type":27,"tag":118,"props":955,"children":956},{},[957,962,967],{"type":27,"tag":65,"props":958,"children":959},{},[960],{"type":33,"value":961},"CDN 缓存（边缘）",{"type":27,"tag":65,"props":963,"children":964},{},[965],{"type":33,"value":966},"Nitro 运行时缓存（storage）",{"type":27,"tag":65,"props":968,"children":969},{},[970],{"type":33,"value":971},"上游服务缓存（数据库/服务端）",{"type":27,"tag":720,"props":973,"children":975},{"id":974},"_61-api-缓存的推荐做法",[976],{"type":33,"value":977},"6.1 API 缓存的推荐做法",{"type":27,"tag":61,"props":979,"children":980},{},[981,992],{"type":27,"tag":65,"props":982,"children":983},{},[984,986],{"type":33,"value":985},"对“读多写少”的接口做 ",{"type":27,"tag":200,"props":987,"children":989},{"className":988},[],[990],{"type":33,"value":991},"stale-while-revalidate",{"type":27,"tag":65,"props":993,"children":994},{},[995],{"type":33,"value":996},"缓存 key 必须包含：用户态/语言/地区/权限等关键维度",{"type":27,"tag":720,"props":998,"children":1000},{"id":999},"_62-不要缓存带用户身份的响应除非你非常确定",[1001],{"type":33,"value":1002},"6.2 不要缓存“带用户身份”的响应（除非你非常确定）",{"type":27,"tag":35,"props":1004,"children":1005},{},[1006],{"type":33,"value":1007},"最容易出事故的是把 A 用户的数据缓存给 B 用户。",{"type":27,"tag":35,"props":1009,"children":1010},{},[1011],{"type":33,"value":1012},"建议：",{"type":27,"tag":61,"props":1014,"children":1015},{},[1016,1021],{"type":27,"tag":65,"props":1017,"children":1018},{},[1019],{"type":33,"value":1020},"默认对用户态接口不缓存",{"type":27,"tag":65,"props":1022,"children":1023},{},[1024,1026,1032,1034,1040],{"type":33,"value":1025},"必须缓存时，key 中加入 ",{"type":27,"tag":200,"props":1027,"children":1029},{"className":1028},[],[1030],{"type":33,"value":1031},"userId",{"type":33,"value":1033}," 或 ",{"type":27,"tag":200,"props":1035,"children":1037},{"className":1036},[],[1038],{"type":33,"value":1039},"session",{"type":33,"value":1041}," 维度",{"type":27,"tag":46,"props":1043,"children":1044},{},[],{"type":27,"tag":28,"props":1046,"children":1048},{"id":1047},"_7-部署适配为什么同一套代码能跑在不同环境",[1049],{"type":33,"value":1050},"7. 部署适配：为什么同一套代码能跑在不同环境？",{"type":27,"tag":35,"props":1052,"children":1053},{},[1054],{"type":33,"value":1055},"Nitro 的部署产物通常包含：",{"type":27,"tag":61,"props":1057,"children":1058},{},[1059,1064,1069],{"type":27,"tag":65,"props":1060,"children":1061},{},[1062],{"type":33,"value":1063},"编译后的 server bundle",{"type":27,"tag":65,"props":1065,"children":1066},{},[1067],{"type":33,"value":1068},"路由清单与运行时配置",{"type":27,"tag":65,"props":1070,"children":1071},{},[1072],{"type":33,"value":1073},"静态资源与预渲染结果（如果启用）",{"type":27,"tag":35,"props":1075,"children":1076},{},[1077],{"type":33,"value":1078},"在不同目标下的差异主要在：",{"type":27,"tag":61,"props":1080,"children":1081},{},[1082,1087,1092],{"type":27,"tag":65,"props":1083,"children":1084},{},[1085],{"type":33,"value":1086},"运行时能力（Node API 是否可用）",{"type":27,"tag":65,"props":1088,"children":1089},{},[1090],{"type":33,"value":1091},"冷启动与并发模型",{"type":27,"tag":65,"props":1093,"children":1094},{},[1095],{"type":33,"value":1096},"文件系统是否可写",{"type":27,"tag":720,"props":1098,"children":1100},{"id":1099},"_71-node-server",[1101],{"type":33,"value":1102},"7.1 Node Server",{"type":27,"tag":61,"props":1104,"children":1105},{},[1106,1111],{"type":27,"tag":65,"props":1107,"children":1108},{},[1109],{"type":33,"value":1110},"能力最完整",{"type":27,"tag":65,"props":1112,"children":1113},{},[1114],{"type":33,"value":1115},"适合长连接、websocket（需配合平台）",{"type":27,"tag":720,"props":1117,"children":1119},{"id":1118},"_72-serverless",[1120],{"type":33,"value":1121},"7.2 Serverless",{"type":27,"tag":61,"props":1123,"children":1124},{},[1125,1130],{"type":27,"tag":65,"props":1126,"children":1127},{},[1128],{"type":33,"value":1129},"冷启动成本、执行时长限制",{"type":27,"tag":65,"props":1131,"children":1132},{},[1133],{"type":33,"value":1134},"更适合 API 型工作负载",{"type":27,"tag":720,"props":1136,"children":1138},{"id":1137},"_73-edge",[1139],{"type":33,"value":1140},"7.3 Edge",{"type":27,"tag":61,"props":1142,"children":1143},{},[1144,1149],{"type":27,"tag":65,"props":1145,"children":1146},{},[1147],{"type":33,"value":1148},"延迟更低",{"type":27,"tag":65,"props":1150,"children":1151},{},[1152],{"type":33,"value":1153},"运行时限制更严格（例如 Node API 不可用）",{"type":27,"tag":35,"props":1155,"children":1156},{},[1157],{"type":33,"value":1158},"实践建议：",{"type":27,"tag":61,"props":1160,"children":1161},{},[1162,1167],{"type":27,"tag":65,"props":1163,"children":1164},{},[1165],{"type":33,"value":1166},"如果你依赖复杂 Node 能力（例如图像处理、原生模块），优先 Node/Serverless",{"type":27,"tag":65,"props":1168,"children":1169},{},[1170],{"type":33,"value":1171},"如果你追求极致延迟且逻辑简单，考虑 Edge",{"type":27,"tag":46,"props":1173,"children":1174},{},[],{"type":27,"tag":28,"props":1176,"children":1178},{"id":1177},"_8-性能调优nitro-侧你能做什么",[1179],{"type":33,"value":1180},"8. 性能调优：Nitro 侧你能做什么？",{"type":27,"tag":720,"props":1182,"children":1184},{"id":1183},"_81-减少阻塞-io",[1185],{"type":33,"value":1186},"8.1 减少阻塞 I/O",{"type":27,"tag":61,"props":1188,"children":1189},{},[1190,1195],{"type":27,"tag":65,"props":1191,"children":1192},{},[1193],{"type":33,"value":1194},"避免请求内做同步文件读写",{"type":27,"tag":65,"props":1196,"children":1197},{},[1198],{"type":33,"value":1199},"对“配置/规则”等可缓存数据做启动预热",{"type":27,"tag":720,"props":1201,"children":1203},{"id":1202},"_82-控制上游依赖",[1204],{"type":33,"value":1205},"8.2 控制上游依赖",{"type":27,"tag":61,"props":1207,"children":1208},{},[1209,1214],{"type":27,"tag":65,"props":1210,"children":1211},{},[1212],{"type":33,"value":1213},"给外部请求设超时（例如 2~3s）",{"type":27,"tag":65,"props":1215,"children":1216},{},[1217],{"type":33,"value":1218},"加重试要谨慎（避免雪崩）",{"type":27,"tag":720,"props":1220,"children":1222},{"id":1221},"_83-响应体积与压缩",[1223],{"type":33,"value":1224},"8.3 响应体积与压缩",{"type":27,"tag":61,"props":1226,"children":1227},{},[1228,1233],{"type":27,"tag":65,"props":1229,"children":1230},{},[1231],{"type":33,"value":1232},"JSON 输出控制字段",{"type":27,"tag":65,"props":1234,"children":1235},{},[1236],{"type":33,"value":1237},"开启 gzip/br",{"type":27,"tag":46,"props":1239,"children":1240},{},[],{"type":27,"tag":28,"props":1242,"children":1244},{"id":1243},"_9-可观测性没有观测就没有稳定",[1245],{"type":33,"value":1246},"9. 可观测性：没有观测就没有“稳定”",{"type":27,"tag":35,"props":1248,"children":1249},{},[1250],{"type":33,"value":1251},"建议 Nitro 侧最小可观测集合：",{"type":27,"tag":61,"props":1253,"children":1254},{},[1255,1260,1265,1270],{"type":27,"tag":65,"props":1256,"children":1257},{},[1258],{"type":33,"value":1259},"requestId/traceId",{"type":27,"tag":65,"props":1261,"children":1262},{},[1263],{"type":33,"value":1264},"关键路由耗时（p50/p95）",{"type":27,"tag":65,"props":1266,"children":1267},{},[1268],{"type":33,"value":1269},"错误率（按路由/按状态码）",{"type":27,"tag":65,"props":1271,"children":1272},{},[1273],{"type":33,"value":1274},"上游依赖耗时（DB/HTTP）",{"type":27,"tag":35,"props":1276,"children":1277},{},[1278],{"type":33,"value":1279},"落地方式：",{"type":27,"tag":61,"props":1281,"children":1282},{},[1283,1288],{"type":27,"tag":65,"props":1284,"children":1285},{},[1286],{"type":33,"value":1287},"在中间件注入 requestId",{"type":27,"tag":65,"props":1289,"children":1290},{},[1291],{"type":33,"value":1292},"在统一错误处理处记录结构化日志",{"type":27,"tag":46,"props":1294,"children":1295},{},[],{"type":27,"tag":28,"props":1297,"children":1299},{"id":1298},"_10-一个推荐的-nitro-工程结构",[1300],{"type":33,"value":1301},"10. 一个推荐的 Nitro 工程结构",{"type":27,"tag":35,"props":1303,"children":1304},{},[1305],{"type":33,"value":1306},"在 Nuxt 项目里，你可以这样组织服务端代码：",{"type":27,"tag":61,"props":1308,"children":1309},{},[1310,1321,1332,1343,1354],{"type":27,"tag":65,"props":1311,"children":1312},{},[1313,1319],{"type":27,"tag":200,"props":1314,"children":1316},{"className":1315},[],[1317],{"type":33,"value":1318},"server/middleware/",{"type":33,"value":1320},"：鉴权、日志、headers、rate limit",{"type":27,"tag":65,"props":1322,"children":1323},{},[1324,1330],{"type":27,"tag":200,"props":1325,"children":1327},{"className":1326},[],[1328],{"type":33,"value":1329},"server/api/",{"type":33,"value":1331},"：业务 API（薄控制器）",{"type":27,"tag":65,"props":1333,"children":1334},{},[1335,1341],{"type":27,"tag":200,"props":1336,"children":1338},{"className":1337},[],[1339],{"type":33,"value":1340},"server/services/",{"type":33,"value":1342},"：领域服务（可复用）",{"type":27,"tag":65,"props":1344,"children":1345},{},[1346,1352],{"type":27,"tag":200,"props":1347,"children":1349},{"className":1348},[],[1350],{"type":33,"value":1351},"server/repositories/",{"type":33,"value":1353},"：数据访问层",{"type":27,"tag":65,"props":1355,"children":1356},{},[1357,1363],{"type":27,"tag":200,"props":1358,"children":1360},{"className":1359},[],[1361],{"type":33,"value":1362},"server/utils/",{"type":33,"value":1364},"：纯工具",{"type":27,"tag":35,"props":1366,"children":1367},{},[1368],{"type":33,"value":1369},"目标是：",{"type":27,"tag":61,"props":1371,"children":1372},{},[1373,1378,1383],{"type":27,"tag":65,"props":1374,"children":1375},{},[1376],{"type":33,"value":1377},"handler 只做协议适配",{"type":27,"tag":65,"props":1379,"children":1380},{},[1381],{"type":33,"value":1382},"业务逻辑可复用、可测试",{"type":27,"tag":65,"props":1384,"children":1385},{},[1386],{"type":33,"value":1387},"横切能力集中化",{"type":27,"tag":46,"props":1389,"children":1390},{},[],{"type":27,"tag":28,"props":1392,"children":1394},{"id":1393},"总结",[1395],{"type":33,"value":1393},{"type":27,"tag":35,"props":1397,"children":1398},{},[1399,1401,1406],{"type":33,"value":1400},"Nitro 的本质是：把 Nuxt 的服务端能力变成一个",{"type":27,"tag":512,"props":1402,"children":1403},{},[1404],{"type":33,"value":1405},"可编译、可移植、可观测",{"type":33,"value":1407},"的运行时系统。",{"type":27,"tag":35,"props":1409,"children":1410},{},[1411],{"type":33,"value":1412},"你一旦理解了它的生命周期与边界，就可以更有信心地在 Nuxt 里做：",{"type":27,"tag":61,"props":1414,"children":1415},{},[1416,1421,1426,1431],{"type":27,"tag":65,"props":1417,"children":1418},{},[1419],{"type":33,"value":1420},"性能友好的 API",{"type":27,"tag":65,"props":1422,"children":1423},{},[1424],{"type":33,"value":1425},"可控的缓存",{"type":27,"tag":65,"props":1427,"children":1428},{},[1429],{"type":33,"value":1430},"稳定的鉴权与错误处理",{"type":27,"tag":65,"props":1432,"children":1433},{},[1434],{"type":33,"value":1435},"面向多环境部署的工程架构",{"title":7,"searchDepth":466,"depth":466,"links":1437},[1438,1439,1440,1441,1449,1450,1451,1455,1460,1465,1466,1467],{"id":503,"depth":469,"text":487},{"id":597,"depth":469,"text":600},{"id":657,"depth":469,"text":660},{"id":699,"depth":469,"text":1442,"children":1443},"3. 路由系统：server/api 与 server/routes 的区别",[1444,1446,1448],{"id":722,"depth":466,"text":1445},"3.1 server/api/*",{"id":751,"depth":466,"text":1447},"3.2 server/routes/*",{"id":775,"depth":466,"text":778},{"id":807,"depth":469,"text":810},{"id":870,"depth":469,"text":873},{"id":945,"depth":469,"text":948,"children":1452},[1453,1454],{"id":974,"depth":466,"text":977},{"id":999,"depth":466,"text":1002},{"id":1047,"depth":469,"text":1050,"children":1456},[1457,1458,1459],{"id":1099,"depth":466,"text":1102},{"id":1118,"depth":466,"text":1121},{"id":1137,"depth":466,"text":1140},{"id":1177,"depth":469,"text":1180,"children":1461},[1462,1463,1464],{"id":1183,"depth":466,"text":1186},{"id":1202,"depth":466,"text":1205},{"id":1221,"depth":466,"text":1224},{"id":1243,"depth":469,"text":1246},{"id":1298,"depth":469,"text":1301},{"id":1393,"depth":469,"text":1393},"content:topics:nuxt:nitro-engine-deep-dive.md","topics/nuxt/nitro-engine-deep-dive.md","topics/nuxt/nitro-engine-deep-dive",{"_path":1472,"_dir":5,"_draft":6,"_partial":6,"_locale":7,"title":1473,"description":1474,"date":489,"topic":5,"author":11,"tags":1475,"image":1479,"featured":497,"readingTime":1480,"body":1481,"_type":478,"_id":2246,"_source":480,"_file":2247,"_stem":2248,"_extension":483},"/topics/nuxt/nuxt-rendering-modes-guide","Nuxt 渲染模式选择指南","从 SEO、性能、成本与一致性出发，系统对比 Nuxt 的 CSR/SSR/SSG/ISR（与预渲染）等模式，给出可执行的选型矩阵与落地架构建议。",[13,492,1476,1477,1478],"SSG","ISR","SEO","/images/topics/nuxt/rendering-modes.jpg",22,{"type":24,"children":1482,"toc":2229},[1483,1488,1493,1498,1526,1538,1541,1547,1552,1575,1580,1583,1589,1595,1600,1618,1623,1642,1648,1652,1665,1669,1682,1688,1692,1705,1709,1722,1728,1733,1746,1750,1763,1767,1780,1786,1790,1803,1807,1820,1823,1829,1834,1995,1998,2004,2009,2027,2032,2045,2048,2054,2059,2064,2087,2092,2110,2113,2119,2137,2140,2146,2199,2202,2206,2211],{"type":27,"tag":28,"props":1484,"children":1486},{"id":1485},"nuxt-渲染模式选择指南",[1487],{"type":33,"value":1473},{"type":27,"tag":35,"props":1489,"children":1490},{},[1491],{"type":33,"value":1492},"“到底要不要 SSR？”是 Nuxt 项目里最常见、也最容易吵起来的问题。",{"type":27,"tag":35,"props":1494,"children":1495},{},[1496],{"type":33,"value":1497},"原因是：渲染模式不是一个单点选择，它同时牵动：",{"type":27,"tag":61,"props":1499,"children":1500},{},[1501,1506,1511,1516,1521],{"type":27,"tag":65,"props":1502,"children":1503},{},[1504],{"type":33,"value":1505},"SEO（可索引内容是否直出）",{"type":27,"tag":65,"props":1507,"children":1508},{},[1509],{"type":33,"value":1510},"性能（TTFB/LCP/INP）",{"type":27,"tag":65,"props":1512,"children":1513},{},[1514],{"type":33,"value":1515},"成本（回源、算力、带宽）",{"type":27,"tag":65,"props":1517,"children":1518},{},[1519],{"type":33,"value":1520},"一致性（内容更新策略、缓存失效）",{"type":27,"tag":65,"props":1522,"children":1523},{},[1524],{"type":33,"value":1525},"工程复杂度（部署、观测、回滚）",{"type":27,"tag":35,"props":1527,"children":1528},{},[1529,1531,1536],{"type":33,"value":1530},"这篇文章给你一套",{"type":27,"tag":512,"props":1532,"children":1533},{},[1534],{"type":33,"value":1535},"可执行的选型方法",{"type":33,"value":1537},"：先定义目标，再选模式，最后给落地结构与检查清单。",{"type":27,"tag":46,"props":1539,"children":1540},{},[],{"type":27,"tag":28,"props":1542,"children":1544},{"id":1543},"_1-四个维度决定你的模式",[1545],{"type":33,"value":1546},"1. 四个维度，决定你的模式",{"type":27,"tag":35,"props":1548,"children":1549},{},[1550],{"type":33,"value":1551},"在做任何选择前，先回答四个问题：",{"type":27,"tag":118,"props":1553,"children":1554},{},[1555,1560,1565,1570],{"type":27,"tag":65,"props":1556,"children":1557},{},[1558],{"type":33,"value":1559},"页面是否需要 SEO？（搜索引擎是否必须看到正文）",{"type":27,"tag":65,"props":1561,"children":1562},{},[1563],{"type":33,"value":1564},"数据是否强一致？（用户态/支付/权限）",{"type":27,"tag":65,"props":1566,"children":1567},{},[1568],{"type":33,"value":1569},"更新频率如何？（发布频繁 vs 偶尔）",{"type":27,"tag":65,"props":1571,"children":1572},{},[1573],{"type":33,"value":1574},"流量模型是什么？（突发、平稳、长尾）",{"type":27,"tag":35,"props":1576,"children":1577},{},[1578],{"type":33,"value":1579},"这些问题比“SSR 快还是慢”更重要。",{"type":27,"tag":46,"props":1581,"children":1582},{},[],{"type":27,"tag":28,"props":1584,"children":1586},{"id":1585},"_2-主要模式概览csr-ssr-ssg-isr-预渲染",[1587],{"type":33,"value":1588},"2. 主要模式概览：CSR / SSR / SSG / ISR / 预渲染",{"type":27,"tag":720,"props":1590,"children":1592},{"id":1591},"_21-csr纯客户端渲染",[1593],{"type":33,"value":1594},"2.1 CSR（纯客户端渲染）",{"type":27,"tag":35,"props":1596,"children":1597},{},[1598],{"type":33,"value":1599},"特点：",{"type":27,"tag":61,"props":1601,"children":1602},{},[1603,1608,1613],{"type":27,"tag":65,"props":1604,"children":1605},{},[1606],{"type":33,"value":1607},"HTML 只有壳",{"type":27,"tag":65,"props":1609,"children":1610},{},[1611],{"type":33,"value":1612},"SEO 风险大（除非你不索引）",{"type":27,"tag":65,"props":1614,"children":1615},{},[1616],{"type":33,"value":1617},"首屏性能取决于 JS 与接口",{"type":27,"tag":35,"props":1619,"children":1620},{},[1621],{"type":33,"value":1622},"适用：",{"type":27,"tag":61,"props":1624,"children":1625},{},[1626,1631],{"type":27,"tag":65,"props":1627,"children":1628},{},[1629],{"type":33,"value":1630},"用户中心、后台、强交互工具",{"type":27,"tag":65,"props":1632,"children":1633},{},[1634,1636],{"type":33,"value":1635},"不需要索引或明确 ",{"type":27,"tag":200,"props":1637,"children":1639},{"className":1638},[],[1640],{"type":33,"value":1641},"noindex",{"type":27,"tag":720,"props":1643,"children":1645},{"id":1644},"_22-ssr服务端渲染",[1646],{"type":33,"value":1647},"2.2 SSR（服务端渲染）",{"type":27,"tag":35,"props":1649,"children":1650},{},[1651],{"type":33,"value":1599},{"type":27,"tag":61,"props":1653,"children":1654},{},[1655,1660],{"type":27,"tag":65,"props":1656,"children":1657},{},[1658],{"type":33,"value":1659},"首屏 HTML 直出，SEO 友好",{"type":27,"tag":65,"props":1661,"children":1662},{},[1663],{"type":33,"value":1664},"每次请求可能都需要回源（需要缓存）",{"type":27,"tag":35,"props":1666,"children":1667},{},[1668],{"type":33,"value":1622},{"type":27,"tag":61,"props":1670,"children":1671},{},[1672,1677],{"type":27,"tag":65,"props":1673,"children":1674},{},[1675],{"type":33,"value":1676},"内容需要 SEO，但数据强动态",{"type":27,"tag":65,"props":1678,"children":1679},{},[1680],{"type":33,"value":1681},"你有完善的缓存策略",{"type":27,"tag":720,"props":1683,"children":1685},{"id":1684},"_23-ssg静态生成",[1686],{"type":33,"value":1687},"2.3 SSG（静态生成）",{"type":27,"tag":35,"props":1689,"children":1690},{},[1691],{"type":33,"value":1599},{"type":27,"tag":61,"props":1693,"children":1694},{},[1695,1700],{"type":27,"tag":65,"props":1696,"children":1697},{},[1698],{"type":33,"value":1699},"性能与稳定性最好",{"type":27,"tag":65,"props":1701,"children":1702},{},[1703],{"type":33,"value":1704},"更新成本在“构建时”",{"type":27,"tag":35,"props":1706,"children":1707},{},[1708],{"type":33,"value":1622},{"type":27,"tag":61,"props":1710,"children":1711},{},[1712,1717],{"type":27,"tag":65,"props":1713,"children":1714},{},[1715],{"type":33,"value":1716},"内容站、文档站、营销页",{"type":27,"tag":65,"props":1718,"children":1719},{},[1720],{"type":33,"value":1721},"更新频率不高或可接受构建延迟",{"type":27,"tag":720,"props":1723,"children":1725},{"id":1724},"_24-isr增量静态再生按需生成",[1726],{"type":33,"value":1727},"2.4 ISR（增量静态再生/按需生成）",{"type":27,"tag":35,"props":1729,"children":1730},{},[1731],{"type":33,"value":1732},"在 Nuxt 体系里，ISR 的表达可能来自：",{"type":27,"tag":61,"props":1734,"children":1735},{},[1736,1741],{"type":27,"tag":65,"props":1737,"children":1738},{},[1739],{"type":33,"value":1740},"生成策略 + 缓存策略",{"type":27,"tag":65,"props":1742,"children":1743},{},[1744],{"type":33,"value":1745},"或配合边缘缓存与按需失效",{"type":27,"tag":35,"props":1747,"children":1748},{},[1749],{"type":33,"value":1599},{"type":27,"tag":61,"props":1751,"children":1752},{},[1753,1758],{"type":27,"tag":65,"props":1754,"children":1755},{},[1756],{"type":33,"value":1757},"静态化收益 + 可控更新",{"type":27,"tag":65,"props":1759,"children":1760},{},[1761],{"type":33,"value":1762},"需要你设计“失效与再生成”",{"type":27,"tag":35,"props":1764,"children":1765},{},[1766],{"type":33,"value":1622},{"type":27,"tag":61,"props":1768,"children":1769},{},[1770,1775],{"type":27,"tag":65,"props":1771,"children":1772},{},[1773],{"type":33,"value":1774},"内容更新频繁，但仍要 SEO",{"type":27,"tag":65,"props":1776,"children":1777},{},[1778],{"type":33,"value":1779},"你希望在高峰也保持稳定",{"type":27,"tag":720,"props":1781,"children":1783},{"id":1782},"_25-预渲染prerender",[1784],{"type":33,"value":1785},"2.5 预渲染（prerender）",{"type":27,"tag":35,"props":1787,"children":1788},{},[1789],{"type":33,"value":1599},{"type":27,"tag":61,"props":1791,"children":1792},{},[1793,1798],{"type":27,"tag":65,"props":1794,"children":1795},{},[1796],{"type":33,"value":1797},"对部分路由预先生成 HTML",{"type":27,"tag":65,"props":1799,"children":1800},{},[1801],{"type":33,"value":1802},"适合混合站点",{"type":27,"tag":35,"props":1804,"children":1805},{},[1806],{"type":33,"value":1622},{"type":27,"tag":61,"props":1808,"children":1809},{},[1810,1815],{"type":27,"tag":65,"props":1811,"children":1812},{},[1813],{"type":33,"value":1814},"首页/核心落地页需要 SEO",{"type":27,"tag":65,"props":1816,"children":1817},{},[1818],{"type":33,"value":1819},"工具页/用户页不需要 SEO",{"type":27,"tag":46,"props":1821,"children":1822},{},[],{"type":27,"tag":28,"props":1824,"children":1826},{"id":1825},"_3-选型矩阵可直接用",[1827],{"type":33,"value":1828},"3. 选型矩阵（可直接用）",{"type":27,"tag":35,"props":1830,"children":1831},{},[1832],{"type":33,"value":1833},"你可以按路由维度做选型，而不是全站一刀切。",{"type":27,"tag":151,"props":1835,"children":1836},{},[1837,1862],{"type":27,"tag":155,"props":1838,"children":1839},{},[1840],{"type":27,"tag":159,"props":1841,"children":1842},{},[1843,1848,1852,1857],{"type":27,"tag":163,"props":1844,"children":1845},{},[1846],{"type":33,"value":1847},"页面类型",{"type":27,"tag":163,"props":1849,"children":1850},{},[1851],{"type":33,"value":1478},{"type":27,"tag":163,"props":1853,"children":1854},{},[1855],{"type":33,"value":1856},"更新频率",{"type":27,"tag":163,"props":1858,"children":1859},{},[1860],{"type":33,"value":1861},"推荐",{"type":27,"tag":179,"props":1863,"children":1864},{},[1865,1888,1909,1930,1951,1973],{"type":27,"tag":159,"props":1866,"children":1867},{},[1868,1873,1878,1883],{"type":27,"tag":186,"props":1869,"children":1870},{},[1871],{"type":33,"value":1872},"文章详情",{"type":27,"tag":186,"props":1874,"children":1875},{},[1876],{"type":33,"value":1877},"高",{"type":27,"tag":186,"props":1879,"children":1880},{},[1881],{"type":33,"value":1882},"中",{"type":27,"tag":186,"props":1884,"children":1885},{},[1886],{"type":33,"value":1887},"SSG/ISR",{"type":27,"tag":159,"props":1889,"children":1890},{},[1891,1896,1900,1904],{"type":27,"tag":186,"props":1892,"children":1893},{},[1894],{"type":33,"value":1895},"文章列表",{"type":27,"tag":186,"props":1897,"children":1898},{},[1899],{"type":33,"value":1877},{"type":27,"tag":186,"props":1901,"children":1902},{},[1903],{"type":33,"value":1882},{"type":27,"tag":186,"props":1905,"children":1906},{},[1907],{"type":33,"value":1908},"SSG/ISR（注意聚合页）",{"type":27,"tag":159,"props":1910,"children":1911},{},[1912,1917,1921,1925],{"type":27,"tag":186,"props":1913,"children":1914},{},[1915],{"type":33,"value":1916},"产品详情",{"type":27,"tag":186,"props":1918,"children":1919},{},[1920],{"type":33,"value":1877},{"type":27,"tag":186,"props":1922,"children":1923},{},[1924],{"type":33,"value":1877},{"type":27,"tag":186,"props":1926,"children":1927},{},[1928],{"type":33,"value":1929},"ISR/SSR（配缓存）",{"type":27,"tag":159,"props":1931,"children":1932},{},[1933,1938,1942,1946],{"type":27,"tag":186,"props":1934,"children":1935},{},[1936],{"type":33,"value":1937},"搜索结果",{"type":27,"tag":186,"props":1939,"children":1940},{},[1941],{"type":33,"value":1882},{"type":27,"tag":186,"props":1943,"children":1944},{},[1945],{"type":33,"value":1877},{"type":27,"tag":186,"props":1947,"children":1948},{},[1949],{"type":33,"value":1950},"SSR/CSR（配 noindex）",{"type":27,"tag":159,"props":1952,"children":1953},{},[1954,1959,1964,1968],{"type":27,"tag":186,"props":1955,"children":1956},{},[1957],{"type":33,"value":1958},"用户中心",{"type":27,"tag":186,"props":1960,"children":1961},{},[1962],{"type":33,"value":1963},"低",{"type":27,"tag":186,"props":1965,"children":1966},{},[1967],{"type":33,"value":1877},{"type":27,"tag":186,"props":1969,"children":1970},{},[1971],{"type":33,"value":1972},"CSR",{"type":27,"tag":159,"props":1974,"children":1975},{},[1976,1981,1986,1990],{"type":27,"tag":186,"props":1977,"children":1978},{},[1979],{"type":33,"value":1980},"工具页",{"type":27,"tag":186,"props":1982,"children":1983},{},[1984],{"type":33,"value":1985},"低/中",{"type":27,"tag":186,"props":1987,"children":1988},{},[1989],{"type":33,"value":1882},{"type":27,"tag":186,"props":1991,"children":1992},{},[1993],{"type":33,"value":1994},"CSR + 预渲染核心路由",{"type":27,"tag":46,"props":1996,"children":1997},{},[],{"type":27,"tag":28,"props":1999,"children":2001},{"id":2000},"_4-混合渲染真正的生产最优解",[2002],{"type":33,"value":2003},"4. 混合渲染：真正的生产最优解",{"type":27,"tag":35,"props":2005,"children":2006},{},[2007],{"type":33,"value":2008},"生产上最常见的模式是混合：",{"type":27,"tag":61,"props":2010,"children":2011},{},[2012,2017,2022],{"type":27,"tag":65,"props":2013,"children":2014},{},[2015],{"type":33,"value":2016},"公共内容：静态化（SSG/ISR）+ CDN",{"type":27,"tag":65,"props":2018,"children":2019},{},[2020],{"type":33,"value":2021},"用户态内容：CSR 或 SSR（private/no-store）",{"type":27,"tag":65,"props":2023,"children":2024},{},[2025],{"type":33,"value":2026},"关键落地页：预渲染",{"type":27,"tag":35,"props":2028,"children":2029},{},[2030],{"type":33,"value":2031},"好处：",{"type":27,"tag":61,"props":2033,"children":2034},{},[2035,2040],{"type":27,"tag":65,"props":2036,"children":2037},{},[2038],{"type":33,"value":2039},"SEO 与性能兼得",{"type":27,"tag":65,"props":2041,"children":2042},{},[2043],{"type":33,"value":2044},"成本可控",{"type":27,"tag":46,"props":2046,"children":2047},{},[],{"type":27,"tag":28,"props":2049,"children":2051},{"id":2050},"_5-缓存与失效模式落地的关键",[2052],{"type":33,"value":2053},"5. 缓存与失效：模式落地的关键",{"type":27,"tag":35,"props":2055,"children":2056},{},[2057],{"type":33,"value":2058},"无论你选 SSR 还是 ISR，本质都离不开缓存。",{"type":27,"tag":35,"props":2060,"children":2061},{},[2062],{"type":33,"value":2063},"建议把缓存分层：",{"type":27,"tag":61,"props":2065,"children":2066},{},[2067,2072,2077,2082],{"type":27,"tag":65,"props":2068,"children":2069},{},[2070],{"type":33,"value":2071},"浏览器",{"type":27,"tag":65,"props":2073,"children":2074},{},[2075],{"type":33,"value":2076},"CDN",{"type":27,"tag":65,"props":2078,"children":2079},{},[2080],{"type":33,"value":2081},"应用侧（server runtime）",{"type":27,"tag":65,"props":2083,"children":2084},{},[2085],{"type":33,"value":2086},"数据侧（Redis/DB）",{"type":27,"tag":35,"props":2088,"children":2089},{},[2090],{"type":33,"value":2091},"并给每条路由明确：",{"type":27,"tag":61,"props":2093,"children":2094},{},[2095,2100,2105],{"type":27,"tag":65,"props":2096,"children":2097},{},[2098],{"type":33,"value":2099},"是否 public/private",{"type":27,"tag":65,"props":2101,"children":2102},{},[2103],{"type":33,"value":2104},"TTL 多久",{"type":27,"tag":65,"props":2106,"children":2107},{},[2108],{"type":33,"value":2109},"写操作后如何失效",{"type":27,"tag":46,"props":2111,"children":2112},{},[],{"type":27,"tag":28,"props":2114,"children":2116},{"id":2115},"_6-常见误区",[2117],{"type":33,"value":2118},"6. 常见误区",{"type":27,"tag":61,"props":2120,"children":2121},{},[2122,2127,2132],{"type":27,"tag":65,"props":2123,"children":2124},{},[2125],{"type":33,"value":2126},"“SSR 一定更快”：不一定，TTFB 可能更慢；LCP 受资源与主线程影响更大",{"type":27,"tag":65,"props":2128,"children":2129},{},[2130],{"type":33,"value":2131},"“SSG 一定更好”：构建成本与发布延迟可能无法接受",{"type":27,"tag":65,"props":2133,"children":2134},{},[2135],{"type":33,"value":2136},"“全站一个模式最省事”：短期省事，长期很难优化与扩展",{"type":27,"tag":46,"props":2138,"children":2139},{},[],{"type":27,"tag":28,"props":2141,"children":2143},{"id":2142},"_7-上线检查清单",[2144],{"type":33,"value":2145},"7. 上线检查清单",{"type":27,"tag":61,"props":2147,"children":2150},{"className":2148},[2149],"contains-task-list",[2151,2163,2172,2181,2190],{"type":27,"tag":65,"props":2152,"children":2155},{"className":2153},[2154],"task-list-item",[2156,2161],{"type":27,"tag":2157,"props":2158,"children":2160},"input",{"disabled":497,"type":2159},"checkbox",[],{"type":33,"value":2162}," 按路由明确 SEO 需求（哪些可索引）",{"type":27,"tag":65,"props":2164,"children":2166},{"className":2165},[2154],[2167,2170],{"type":27,"tag":2157,"props":2168,"children":2169},{"disabled":497,"type":2159},[],{"type":33,"value":2171}," 用户态页面是否 private/no-store",{"type":27,"tag":65,"props":2173,"children":2175},{"className":2174},[2154],[2176,2179],{"type":27,"tag":2157,"props":2177,"children":2178},{"disabled":497,"type":2159},[],{"type":33,"value":2180}," 公共内容是否走 CDN 并有合理 TTL",{"type":27,"tag":65,"props":2182,"children":2184},{"className":2183},[2154],[2185,2188],{"type":27,"tag":2157,"props":2186,"children":2187},{"disabled":497,"type":2159},[],{"type":33,"value":2189}," 更新路径是否有失效机制（发布事件）",{"type":27,"tag":65,"props":2191,"children":2193},{"className":2192},[2154],[2194,2197],{"type":27,"tag":2157,"props":2195,"children":2196},{"disabled":497,"type":2159},[],{"type":33,"value":2198}," 是否有 RUM/日志来验证效果",{"type":27,"tag":46,"props":2200,"children":2201},{},[],{"type":27,"tag":28,"props":2203,"children":2204},{"id":1393},[2205],{"type":33,"value":1393},{"type":27,"tag":35,"props":2207,"children":2208},{},[2209],{"type":33,"value":2210},"Nuxt 渲染模式选型的正确做法是：",{"type":27,"tag":61,"props":2212,"children":2213},{},[2214,2219,2224],{"type":27,"tag":65,"props":2215,"children":2216},{},[2217],{"type":33,"value":2218},"以“页面类型”而不是“站点整体”做选择",{"type":27,"tag":65,"props":2220,"children":2221},{},[2222],{"type":33,"value":2223},"把缓存与失效当成一等公民",{"type":27,"tag":65,"props":2225,"children":2226},{},[2227],{"type":33,"value":2228},"用观测验证，而不是凭感觉",{"title":7,"searchDepth":466,"depth":466,"links":2230},[2231,2232,2233,2240,2241,2242,2243,2244,2245],{"id":1485,"depth":469,"text":1473},{"id":1543,"depth":469,"text":1546},{"id":1585,"depth":469,"text":1588,"children":2234},[2235,2236,2237,2238,2239],{"id":1591,"depth":466,"text":1594},{"id":1644,"depth":466,"text":1647},{"id":1684,"depth":466,"text":1687},{"id":1724,"depth":466,"text":1727},{"id":1782,"depth":466,"text":1785},{"id":1825,"depth":469,"text":1828},{"id":2000,"depth":469,"text":2003},{"id":2050,"depth":469,"text":2053},{"id":2115,"depth":469,"text":2118},{"id":2142,"depth":469,"text":2145},{"id":1393,"depth":469,"text":1393},"content:topics:nuxt:nuxt-rendering-modes-guide.md","topics/nuxt/nuxt-rendering-modes-guide.md","topics/nuxt/nuxt-rendering-modes-guide",{"_path":2250,"_dir":5,"_draft":6,"_partial":6,"_locale":7,"title":2251,"description":2252,"date":2253,"topic":5,"author":11,"tags":2254,"image":2258,"featured":497,"readingTime":2259,"body":2260,"_type":478,"_id":2786,"_source":480,"_file":2787,"_stem":2788,"_extension":483},"/topics/nuxt/nuxt4-major-updates-overview","Nuxt 4 重大更新全面解读：架构升级与开发体验革新","深入解析 Nuxt 4 的重大更新，包括新目录结构、Nitro 2.0 引擎、兼容性层变化、性能优化等核心改进，帮助开发者全面了解新版本特性并做好升级准备。","2026-01-18",[2255,15,492,2256,2257],"Nuxt 4","全栈框架","版本升级","/images/topics/nuxt/nuxt4-features-overview.jpg",16,{"type":24,"children":2261,"toc":2747},[2262,2268,2274,2279,2284,2290,2296,2301,2310,2318,2326,2332,2337,2348,2354,2363,2369,2375,2380,2389,2395,2404,2410,2419,2425,2431,2440,2446,2455,2461,2470,2476,2482,2491,2497,2506,2512,2523,2532,2538,2544,2553,2559,2568,2574,2583,2589,2595,2604,2610,2619,2625,2631,2641,2647,2656,2662,2667,2672,2677,2695,2698,2703],{"type":27,"tag":28,"props":2263,"children":2265},{"id":2264},"nuxt-4-重大更新全面解读",[2266],{"type":33,"value":2267},"Nuxt 4 重大更新全面解读",{"type":27,"tag":28,"props":2269,"children":2271},{"id":2270},"引言nuxt-的又一次进化",[2272],{"type":33,"value":2273},"引言：Nuxt 的又一次进化",{"type":27,"tag":35,"props":2275,"children":2276},{},[2277],{"type":33,"value":2278},"Nuxt 4 的发布标志着这个 Vue 生态中最受欢迎的全栈框架又迈入了新阶段。从 Nuxt 2 到 Nuxt 3 是一次彻底重写，而 Nuxt 3 到 Nuxt 4 则是在成熟架构上的精进打磨——更清晰的目录结构、更强大的引擎、更好的开发体验。",{"type":27,"tag":35,"props":2280,"children":2281},{},[2282],{"type":33,"value":2283},"这篇文章将全面解读 Nuxt 4 的核心变化，帮助你理解这些改动背后的设计理念，以及它们将如何影响你的日常开发。",{"type":27,"tag":28,"props":2285,"children":2287},{"id":2286},"第一部分新目录结构",[2288],{"type":33,"value":2289},"第一部分：新目录结构",{"type":27,"tag":720,"props":2291,"children":2293},{"id":2292},"_11-从扁平到分层",[2294],{"type":33,"value":2295},"1.1 从扁平到分层",{"type":27,"tag":35,"props":2297,"children":2298},{},[2299],{"type":33,"value":2300},"Nuxt 4 引入了新的目录结构，将应用代码与配置分离：",{"type":27,"tag":2302,"props":2303,"children":2305},"pre",{"code":2304},"# Nuxt 3 目录结构\nproject/\n├── .nuxt/\n├── app.vue\n├── components/\n├── composables/\n├── layouts/\n├── middleware/\n├── pages/\n├── plugins/\n├── public/\n├── server/\n├── nuxt.config.ts\n└── package.json\n\n# Nuxt 4 新目录结构\nproject/\n├── .nuxt/\n├── app/                  # 应用代码集中在 app/ 目录\n│   ├── app.vue\n│   ├── components/\n│   ├── composables/\n│   ├── layouts/\n│   ├── middleware/\n│   ├── pages/\n│   └── plugins/\n├── public/\n├── server/\n├── nuxt.config.ts\n└── package.json\n",[2306],{"type":27,"tag":200,"props":2307,"children":2308},{"__ignoreMap":7},[2309],{"type":33,"value":2304},{"type":27,"tag":35,"props":2311,"children":2312},{},[2313],{"type":27,"tag":512,"props":2314,"children":2315},{},[2316],{"type":33,"value":2317},"为什么这样设计？",{"type":27,"tag":2302,"props":2319,"children":2321},{"code":2320},"┌────────────────────────────────────────────────────────────┐\n│              新目录结构的设计理念                            │\n├────────────────────────────────────────────────────────────┤\n│                                                            │\n│  1. 关注点分离                                             │\n│     ├── app/ - 客户端/同构代码                             │\n│     ├── server/ - 服务端代码                               │\n│     └── 根目录 - 配置和公共资源                             │\n│                                                            │\n│  2. 更清晰的项目边界                                       │\n│     ├── Monorepo 友好                                      │\n│     ├── 多应用项目更清晰                                   │\n│     └── 与其他框架惯例对齐                                 │\n│                                                            │\n│  3. 未来扩展性                                             │\n│     ├── 为多前端支持做准备                                 │\n│     └── 便于工具链识别和处理                               │\n│                                                            │\n└────────────────────────────────────────────────────────────┘\n",[2322],{"type":27,"tag":200,"props":2323,"children":2324},{"__ignoreMap":7},[2325],{"type":33,"value":2320},{"type":27,"tag":720,"props":2327,"children":2329},{"id":2328},"_12-向后兼容",[2330],{"type":33,"value":2331},"1.2 向后兼容",{"type":27,"tag":35,"props":2333,"children":2334},{},[2335],{"type":33,"value":2336},"Nuxt 4 提供了兼容性选项，允许继续使用旧目录结构：",{"type":27,"tag":2302,"props":2338,"children":2343},{"code":2339,"language":2340,"meta":7,"className":2341},"// nuxt.config.ts\nexport default defineNuxtConfig({\n  future: {\n    compatibilityVersion: 4  // 启用 Nuxt 4 特性\n  },\n  \n  // 如果需要继续使用旧目录结构\n  srcDir: './',  // 而不是 'app/'\n  \n  // 或者自定义目录\n  dir: {\n    app: 'src',\n    pages: 'src/pages',\n    layouts: 'src/layouts'\n  }\n});\n","typescript",[2342],"language-typescript",[2344],{"type":27,"tag":200,"props":2345,"children":2346},{"__ignoreMap":7},[2347],{"type":33,"value":2339},{"type":27,"tag":720,"props":2349,"children":2351},{"id":2350},"_13-appconfigts-变化",[2352],{"type":33,"value":2353},"1.3 app.config.ts 变化",{"type":27,"tag":2302,"props":2355,"children":2358},{"code":2356,"language":2340,"meta":7,"className":2357},"// Nuxt 3: app.config.ts 在项目根目录\n// Nuxt 4: app.config.ts 移入 app/ 目录\n\n// app/app.config.ts\nexport default defineAppConfig({\n  ui: {\n    primary: 'green',\n    gray: 'slate'\n  },\n  \n  // 类型安全的应用配置\n  meta: {\n    name: 'My App',\n    description: 'A Nuxt 4 Application'\n  }\n});\n\n// 使用方式不变\nconst appConfig = useAppConfig();\nconsole.log(appConfig.ui.primary);  // 'green'\n",[2342],[2359],{"type":27,"tag":200,"props":2360,"children":2361},{"__ignoreMap":7},[2362],{"type":33,"value":2356},{"type":27,"tag":28,"props":2364,"children":2366},{"id":2365},"第二部分nitro-20-引擎升级",[2367],{"type":33,"value":2368},"第二部分：Nitro 2.0 引擎升级",{"type":27,"tag":720,"props":2370,"children":2372},{"id":2371},"_21-性能提升",[2373],{"type":33,"value":2374},"2.1 性能提升",{"type":27,"tag":35,"props":2376,"children":2377},{},[2378],{"type":33,"value":2379},"Nitro 2.0 带来了显著的性能改进：",{"type":27,"tag":2302,"props":2381,"children":2384},{"code":2382,"language":2340,"meta":7,"className":2383},"// 冷启动时间优化\n// Nitro 1.x: ~150ms\n// Nitro 2.0: ~80ms (约 47% 提升)\n\n// 内存占用优化\n// 同样的应用，内存占用减少约 20%\n\n// 原因：\n// - 更高效的模块加载\n// - 优化的树摇（tree-shaking）\n// - 减少运行时开销\n",[2342],[2385],{"type":27,"tag":200,"props":2386,"children":2387},{"__ignoreMap":7},[2388],{"type":33,"value":2382},{"type":27,"tag":720,"props":2390,"children":2392},{"id":2391},"_22-新的路由系统",[2393],{"type":33,"value":2394},"2.2 新的路由系统",{"type":27,"tag":2302,"props":2396,"children":2399},{"code":2397,"language":2340,"meta":7,"className":2398},"// server/routes/api/[...slug].ts\n\n// Nitro 2.0 新的路由定义方式\nexport default defineEventHandler({\n  // 路由级别配置\n  config: {\n    // 缓存配置\n    cache: {\n      maxAge: 60,\n      staleMaxAge: 3600,\n      swr: true\n    },\n    \n    // CORS 配置\n    cors: {\n      origin: ['https://example.com'],\n      methods: ['GET', 'POST']\n    }\n  },\n  \n  // 处理函数\n  handler: async (event) => {\n    const slug = event.context.params?.slug;\n    return { data: await fetchData(slug) };\n  }\n});\n\n// 支持中间件链\nexport default defineEventHandler({\n  onRequest: [authMiddleware, rateLimitMiddleware],\n  onBeforeResponse: [logMiddleware],\n  \n  handler: (event) => {\n    return { message: 'Hello' };\n  }\n});\n",[2342],[2400],{"type":27,"tag":200,"props":2401,"children":2402},{"__ignoreMap":7},[2403],{"type":33,"value":2397},{"type":27,"tag":720,"props":2405,"children":2407},{"id":2406},"_23-增强的数据获取",[2408],{"type":33,"value":2409},"2.3 增强的数据获取",{"type":27,"tag":2302,"props":2411,"children":2414},{"code":2412,"language":2340,"meta":7,"className":2413},"// Nitro 2.0 改进的 $fetch\n\n// 自动请求去重\nconst [user, posts] = await Promise.all([\n  $fetch('/api/user/1'),\n  $fetch('/api/user/1')  // 相同请求自动去重\n]);\n\n// 请求拦截器\nexport default defineNuxtPlugin(() => {\n  const { $fetch } = useNuxtApp();\n  \n  // 全局请求配置\n  globalThis.$fetch = $fetch.create({\n    onRequest({ request, options }) {\n      options.headers = {\n        ...options.headers,\n        Authorization: `Bearer ${getToken()}`\n      };\n    },\n    \n    onResponseError({ response }) {\n      if (response.status === 401) {\n        navigateTo('/login');\n      }\n    }\n  });\n});\n",[2342],[2415],{"type":27,"tag":200,"props":2416,"children":2417},{"__ignoreMap":7},[2418],{"type":33,"value":2412},{"type":27,"tag":28,"props":2420,"children":2422},{"id":2421},"第三部分兼容性层变化",[2423],{"type":33,"value":2424},"第三部分：兼容性层变化",{"type":27,"tag":720,"props":2426,"children":2428},{"id":2427},"_31-移除的废弃-api",[2429],{"type":33,"value":2430},"3.1 移除的废弃 API",{"type":27,"tag":2302,"props":2432,"children":2435},{"code":2433,"language":2340,"meta":7,"className":2434},"// Nuxt 4 移除了 Nuxt 3 中标记为废弃的 API\n\n// ❌ 已移除\nimport { defineNuxtRouteMiddleware } from '#app'\n\n// ✅ 使用新的 API\nimport { defineNuxtRouteMiddleware } from 'nuxt/app'\n\n// ❌ 已移除\nconst nuxtApp = useNuxtApp()\nnuxtApp.$router  // 不再有 $ 前缀\n\n// ✅ 使用 composables\nconst router = useRouter()\n\n// ❌ 已移除\nuseAsyncData('key', () => fetch(), { lazy: true })\n\n// ✅ 使用 useLazyAsyncData\nuseLazyAsyncData('key', () => fetch())\n",[2342],[2436],{"type":27,"tag":200,"props":2437,"children":2438},{"__ignoreMap":7},[2439],{"type":33,"value":2433},{"type":27,"tag":720,"props":2441,"children":2443},{"id":2442},"_32-类型系统改进",[2444],{"type":33,"value":2445},"3.2 类型系统改进",{"type":27,"tag":2302,"props":2447,"children":2450},{"code":2448,"language":2340,"meta":7,"className":2449},"// Nuxt 4 增强的类型推导\n\n// 页面元数据类型\n// pages/dashboard.vue\n\u003Cscript setup lang=\"ts\">\ndefinePageMeta({\n  // 类型自动推导，IDE 自动补全\n  layout: 'admin',  // 只能填已定义的布局\n  middleware: ['auth'],  // 只能填已定义的中间件\n  \n  // 自定义元数据\n  title: '仪表盘',\n  requiresAuth: true\n});\n\u003C/script>\n\n// 路由参数类型\n// pages/users/[id].vue\n\u003Cscript setup lang=\"ts\">\nconst route = useRoute('users-id');\n//             ^? RouteLocationNormalized\u003C'users-id'>\n\nroute.params.id  // 类型: string\n\u003C/script>\n\n// 运行时配置类型\n// nuxt.config.ts\nexport default defineNuxtConfig({\n  runtimeConfig: {\n    // 私有配置（仅服务端）\n    apiSecret: '',\n    \n    // 公开配置\n    public: {\n      apiBase: ''\n    }\n  }\n});\n\n// 使用时自动推导类型\nconst config = useRuntimeConfig();\nconfig.apiSecret;  // 服务端可用\nconfig.public.apiBase;  // 客户端可用\n",[2342],[2451],{"type":27,"tag":200,"props":2452,"children":2453},{"__ignoreMap":7},[2454],{"type":33,"value":2448},{"type":27,"tag":720,"props":2456,"children":2458},{"id":2457},"_33-useasyncdata-改进",[2459],{"type":33,"value":2460},"3.3 useAsyncData 改进",{"type":27,"tag":2302,"props":2462,"children":2465},{"code":2463,"language":2340,"meta":7,"className":2464},"// Nuxt 4 中 useAsyncData 的改进\n\n// 改进 1：更好的错误处理\nconst { data, error, status } = await useAsyncData('users', () => $fetch('/api/users'));\n\n// status 新增更多状态\n// 'idle' | 'pending' | 'success' | 'error'\n\n// 改进 2：简化的刷新机制\nconst { refresh, clear } = await useAsyncData('users', () => $fetch('/api/users'));\n\n// 带参数刷新\nawait refresh({ dedupe: true });\n\n// 清除缓存\nclear();\n\n// 改进 3：深度响应式默认关闭\nconst { data } = await useAsyncData('config', () => $fetch('/api/config'), {\n  deep: false  // 默认 false，提升性能\n});\n\n// 需要深度响应式时显式开启\nconst { data } = await useAsyncData('form', () => $fetch('/api/form'), {\n  deep: true\n});\n",[2342],[2466],{"type":27,"tag":200,"props":2467,"children":2468},{"__ignoreMap":7},[2469],{"type":33,"value":2463},{"type":27,"tag":28,"props":2471,"children":2473},{"id":2472},"第四部分开发体验改进",[2474],{"type":33,"value":2475},"第四部分：开发体验改进",{"type":27,"tag":720,"props":2477,"children":2479},{"id":2478},"_41-nuxt-devtools-增强",[2480],{"type":33,"value":2481},"4.1 Nuxt DevTools 增强",{"type":27,"tag":2302,"props":2483,"children":2486},{"code":2484,"language":2340,"meta":7,"className":2485},"// Nuxt 4 内置增强版 DevTools\n\n// 新功能：\n// 1. 组件性能分析\n// - 渲染时间追踪\n// - 不必要渲染检测\n// - 内存使用监控\n\n// 2. 数据流可视化\n// - useAsyncData 调用时序图\n// - 数据缓存状态\n// - 请求去重可视化\n\n// 3. 路由调试\n// - 路由匹配过程\n// - 中间件执行顺序\n// - 导航守卫状态\n\n// 启用高级功能\nexport default defineNuxtConfig({\n  devtools: {\n    enabled: true,\n    \n    // 新选项\n    timeline: {\n      enabled: true  // 启用时间线\n    }\n  }\n});\n",[2342],[2487],{"type":27,"tag":200,"props":2488,"children":2489},{"__ignoreMap":7},[2490],{"type":33,"value":2484},{"type":27,"tag":720,"props":2492,"children":2494},{"id":2493},"_42-热更新优化",[2495],{"type":33,"value":2496},"4.2 热更新优化",{"type":27,"tag":2302,"props":2498,"children":2501},{"code":2499,"language":2340,"meta":7,"className":2500},"// Nuxt 4 大幅改进了热更新体验\n\n// 1. 更快的 HMR\n// - 组件变更：\u003C 100ms\n// - 页面变更：\u003C 200ms\n// - 配置变更：\u003C 1s\n\n// 2. 保持状态的更新\n// composables 更新不再丢失组件状态\nconst count = ref(0);  // 更新文件后，值保持\n\n// 3. 错误恢复\n// 修复语法错误后自动恢复，无需重启\n",[2342],[2502],{"type":27,"tag":200,"props":2503,"children":2504},{"__ignoreMap":7},[2505],{"type":33,"value":2499},{"type":27,"tag":720,"props":2507,"children":2509},{"id":2508},"_43-错误处理增强",[2510],{"type":33,"value":2511},"4.3 错误处理增强",{"type":27,"tag":2302,"props":2513,"children":2518},{"code":2514,"language":2515,"meta":7,"className":2516},"\u003C!-- app/error.vue - 增强的错误页面 -->\n\u003Ctemplate>\n  \u003Cdiv class=\"error-page\">\n    \u003Ch1>{{ error.statusCode }}\u003C/h1>\n    \u003Cp>{{ error.message }}\u003C/p>\n    \n    \u003C!-- Nuxt 4 新增：错误堆栈（开发环境） -->\n    \u003Cpre v-if=\"isDev && error.stack\">{{ error.stack }}\u003C/pre>\n    \n    \u003C!-- 新增：错误上下文 -->\n    \u003Cdetails v-if=\"error.data\">\n      \u003Csummary>详细信息\u003C/summary>\n      \u003Cpre>{{ error.data }}\u003C/pre>\n    \u003C/details>\n    \n    \u003Cbutton @click=\"handleError\">重试\u003C/button>\n  \u003C/div>\n\u003C/template>\n\n\u003Cscript setup lang=\"ts\">\nconst props = defineProps\u003C{\n  error: {\n    statusCode: number\n    message: string\n    stack?: string\n    data?: Record\u003Cstring, unknown>\n  }\n}>();\n\nconst isDev = process.dev;\n\nfunction handleError() {\n  clearError({ redirect: '/' });\n}\n\u003C/script>\n","vue",[2517],"language-vue",[2519],{"type":27,"tag":200,"props":2520,"children":2521},{"__ignoreMap":7},[2522],{"type":33,"value":2514},{"type":27,"tag":2302,"props":2524,"children":2527},{"code":2525,"language":2340,"meta":7,"className":2526},"// server/api/users.ts - 增强的服务端错误\n\nexport default defineEventHandler((event) => {\n  const id = getRouterParam(event, 'id');\n  \n  if (!id) {\n    throw createError({\n      statusCode: 400,\n      message: '缺少用户 ID',\n      \n      // Nuxt 4 新增：结构化错误数据\n      data: {\n        field: 'id',\n        constraint: 'required'\n      }\n    });\n  }\n  \n  // 业务错误\n  throw createError({\n    statusCode: 404,\n    message: '用户不存在',\n    data: {\n      userId: id,\n      suggestion: '请检查用户 ID 是否正确'\n    }\n  });\n});\n",[2342],[2528],{"type":27,"tag":200,"props":2529,"children":2530},{"__ignoreMap":7},[2531],{"type":33,"value":2525},{"type":27,"tag":28,"props":2533,"children":2535},{"id":2534},"第五部分性能优化特性",[2536],{"type":33,"value":2537},"第五部分：性能优化特性",{"type":27,"tag":720,"props":2539,"children":2541},{"id":2540},"_51-更智能的代码分割",[2542],{"type":33,"value":2543},"5.1 更智能的代码分割",{"type":27,"tag":2302,"props":2545,"children":2548},{"code":2546,"language":2340,"meta":7,"className":2547},"// Nuxt 4 的自动代码分割更加智能\n\n// 自动路由分割\n// pages/dashboard/\n//   index.vue      -> chunks/dashboard.js\n//   settings.vue   -> chunks/dashboard-settings.js\n//   analytics.vue  -> chunks/dashboard-analytics.js\n\n// 组件级分割\n// components/\n//   HeavyChart.vue -> chunks/heavy-chart.js (自动延迟加载)\n\n// 手动优化\nexport default defineNuxtConfig({\n  vite: {\n    build: {\n      rollupOptions: {\n        output: {\n          // 自定义分块策略\n          manualChunks: {\n            'vendor-vue': ['vue', 'vue-router', 'pinia'],\n            'vendor-ui': ['element-plus']\n          }\n        }\n      }\n    }\n  }\n});\n",[2342],[2549],{"type":27,"tag":200,"props":2550,"children":2551},{"__ignoreMap":7},[2552],{"type":33,"value":2546},{"type":27,"tag":720,"props":2554,"children":2556},{"id":2555},"_52-图片优化增强",[2557],{"type":33,"value":2558},"5.2 图片优化增强",{"type":27,"tag":2302,"props":2560,"children":2563},{"code":2561,"language":2515,"meta":7,"className":2562},"\u003C!-- Nuxt 4 的 nuxt-img 增强 -->\n\u003Ctemplate>\n  \u003CNuxtImg\n    src=\"/images/hero.jpg\"\n    \n    \u003C!-- 新增：自动格式选择 -->\n    format=\"webp,avif\"\n    \n    \u003C!-- 新增：艺术指导响应式 -->\n    :sources=\"[\n      { media: '(max-width: 640px)', src: '/images/hero-mobile.jpg' },\n      { media: '(max-width: 1024px)', src: '/images/hero-tablet.jpg' }\n    ]\"\n    \n    \u003C!-- 新增：模糊占位符 -->\n    placeholder=\"/images/hero-blur.jpg\"\n    \n    \u003C!-- 新增：性能提示 -->\n    :priority=\"true\"\n    fetchpriority=\"high\"\n  />\n\u003C/template>\n\n\u003Cscript setup>\n// 编程式使用\nconst img = useImage();\n\n// 生成优化后的 URL\nconst optimizedUrl = img('/images/photo.jpg', {\n  width: 800,\n  height: 600,\n  format: 'webp',\n  quality: 80\n});\n\u003C/script>\n",[2517],[2564],{"type":27,"tag":200,"props":2565,"children":2566},{"__ignoreMap":7},[2567],{"type":33,"value":2561},{"type":27,"tag":720,"props":2569,"children":2571},{"id":2570},"_53-服务端渲染优化",[2572],{"type":33,"value":2573},"5.3 服务端渲染优化",{"type":27,"tag":2302,"props":2575,"children":2578},{"code":2576,"language":2340,"meta":7,"className":2577},"// Nuxt 4 SSR 性能优化\n\n// 1. 流式 SSR\n// nuxt.config.ts\nexport default defineNuxtConfig({\n  nitro: {\n    // 启用流式 SSR\n    experimental: {\n      wasm: true\n    }\n  },\n  \n  // 组件流式渲染\n  experimental: {\n    componentIslands: true,  // 组件岛\n    payloadExtraction: true  // Payload 提取\n  }\n});\n\n// 2. 选择性 Hydration\n// pages/article/[id].vue\n\u003Ctemplate>\n  \u003Carticle>\n    \u003C!-- 静态内容，不需要 hydration -->\n    \u003CNuxtIsland name=\"ArticleContent\" :props=\"{ content }\" />\n    \n    \u003C!-- 需要交互的部分 -->\n    \u003CCommentSection :articleId=\"id\" />\n  \u003C/article>\n\u003C/template>\n\n// 3. 预加载优化\n\u003Cscript setup>\n// 智能预加载\nconst { data } = await useAsyncData('article', () => $fetch('/api/article/' + id), {\n  // 预加载相关数据\n  preload: [\n    () => $fetch('/api/comments/' + id),\n    () => $fetch('/api/related/' + id)\n  ]\n});\n\u003C/script>\n",[2342],[2579],{"type":27,"tag":200,"props":2580,"children":2581},{"__ignoreMap":7},[2582],{"type":33,"value":2576},{"type":27,"tag":28,"props":2584,"children":2586},{"id":2585},"第六部分模块生态更新",[2587],{"type":33,"value":2588},"第六部分：模块生态更新",{"type":27,"tag":720,"props":2590,"children":2592},{"id":2591},"_61-官方模块适配",[2593],{"type":33,"value":2594},"6.1 官方模块适配",{"type":27,"tag":2302,"props":2596,"children":2599},{"code":2597,"language":2340,"meta":7,"className":2598},"// 主要官方模块的 Nuxt 4 兼容版本\n\n// @nuxtjs/i18n v9\nexport default defineNuxtConfig({\n  modules: ['@nuxtjs/i18n'],\n  \n  i18n: {\n    // 新增：编译时优化\n    bundle: {\n      optimizeTranslations: true\n    },\n    \n    // 新增：类型生成\n    types: 'composition'\n  }\n});\n\n// @nuxt/content v3\nexport default defineNuxtConfig({\n  modules: ['@nuxt/content'],\n  \n  content: {\n    // 新增：更强的查询 API\n    experimental: {\n      clientDB: true,\n      stripQueryParameters: true\n    }\n  }\n});\n\n// @pinia/nuxt v0.6\nexport default defineNuxtConfig({\n  modules: ['@pinia/nuxt'],\n  \n  pinia: {\n    // 新增：自动导入优化\n    storesDirs: ['./stores/**']\n  }\n});\n",[2342],[2600],{"type":27,"tag":200,"props":2601,"children":2602},{"__ignoreMap":7},[2603],{"type":33,"value":2597},{"type":27,"tag":720,"props":2605,"children":2607},{"id":2606},"_62-创建-nuxt-4-兼容模块",[2608],{"type":33,"value":2609},"6.2 创建 Nuxt 4 兼容模块",{"type":27,"tag":2302,"props":2611,"children":2614},{"code":2612,"language":2340,"meta":7,"className":2613},"// 模块开发的新约定\n\n// my-module/src/module.ts\nimport { defineNuxtModule, createResolver } from '@nuxt/kit'\n\nexport default defineNuxtModule({\n  meta: {\n    name: 'my-module',\n    configKey: 'myModule',\n    \n    // Nuxt 4 要求\n    compatibility: {\n      nuxt: '^4.0.0'\n    }\n  },\n  \n  defaults: {\n    enabled: true\n  },\n  \n  setup(options, nuxt) {\n    const resolver = createResolver(import.meta.url);\n    \n    // 使用新的 hook API\n    nuxt.hook('app:resolve', (app) => {\n      // app 配置\n    });\n    \n    // 添加运行时插件\n    addPlugin(resolver.resolve('./runtime/plugin'));\n    \n    // 添加组件\n    addComponentsDir({\n      path: resolver.resolve('./runtime/components'),\n      prefix: 'MyModule'\n    });\n  }\n});\n",[2342],[2615],{"type":27,"tag":200,"props":2616,"children":2617},{"__ignoreMap":7},[2618],{"type":33,"value":2612},{"type":27,"tag":28,"props":2620,"children":2622},{"id":2621},"第七部分迁移准备",[2623],{"type":33,"value":2624},"第七部分：迁移准备",{"type":27,"tag":720,"props":2626,"children":2628},{"id":2627},"_71-兼容性检查清单",[2629],{"type":33,"value":2630},"7.1 兼容性检查清单",{"type":27,"tag":2302,"props":2632,"children":2636},{"code":2633,"language":478,"meta":7,"className":2634},"## Nuxt 4 迁移检查清单\n\n### 依赖版本\n- [ ] Node.js >= 20\n- [ ] Vue >= 3.4\n- [ ] TypeScript >= 5.3（推荐）\n\n### 代码检查\n- [ ] 移除已废弃的 API 调用\n- [ ] 更新 composables 导入路径\n- [ ] 检查 useAsyncData 用法\n- [ ] 审查中间件语法\n\n### 目录结构\n- [ ] 决定是否采用新目录结构\n- [ ] 移动文件到 app/ 目录（如果采用）\n- [ ] 更新 nuxt.config.ts 配置\n\n### 模块更新\n- [ ] 更新官方模块到兼容版本\n- [ ] 检查第三方模块兼容性\n- [ ] 更新自定义模块\n\n### 测试\n- [ ] 运行全部测试套件\n- [ ] 验证 SSR/SSG 输出\n- [ ] 检查 hydration 错误\n- [ ] 性能基准测试\n",[2635],"language-markdown",[2637],{"type":27,"tag":200,"props":2638,"children":2639},{"__ignoreMap":7},[2640],{"type":33,"value":2633},{"type":27,"tag":720,"props":2642,"children":2644},{"id":2643},"_72-渐进式升级路径",[2645],{"type":33,"value":2646},"7.2 渐进式升级路径",{"type":27,"tag":2302,"props":2648,"children":2651},{"code":2649,"language":2340,"meta":7,"className":2650},"// 使用 compatibilityVersion 实现渐进升级\n\n// 阶段 1：启用 Nuxt 4 特性（保持旧目录结构）\nexport default defineNuxtConfig({\n  future: {\n    compatibilityVersion: 4\n  },\n  srcDir: './'  // 保持旧目录结构\n});\n\n// 阶段 2：迁移到新目录结构\n// 1. 创建 app/ 目录\n// 2. 移动文件\n// 3. 更新导入路径\n\n// 阶段 3：完全升级\nexport default defineNuxtConfig({\n  // 移除 future 配置，默认使用 Nuxt 4 行为\n});\n",[2342],[2652],{"type":27,"tag":200,"props":2653,"children":2654},{"__ignoreMap":7},[2655],{"type":33,"value":2649},{"type":27,"tag":28,"props":2657,"children":2659},{"id":2658},"结语稳步前进的进化",[2660],{"type":33,"value":2661},"结语：稳步前进的进化",{"type":27,"tag":35,"props":2663,"children":2664},{},[2665],{"type":33,"value":2666},"Nuxt 4 不是一次颠覆性的重写，而是在 Nuxt 3 坚实基础上的持续改进。新的目录结构带来更好的组织性，Nitro 2.0 带来更好的性能，增强的类型系统带来更好的开发体验。",{"type":27,"tag":35,"props":2668,"children":2669},{},[2670],{"type":33,"value":2671},"对于 Nuxt 3 用户来说，升级路径相对平滑。核心概念没有变化，熟悉的 API 依然工作。Nuxt 团队显然吸取了 Nuxt 2 到 Nuxt 3 升级的经验，这次提供了更友好的迁移体验。",{"type":27,"tag":35,"props":2673,"children":2674},{},[2675],{"type":33,"value":2676},"如果你正在考虑是否升级，建议：",{"type":27,"tag":61,"props":2678,"children":2679},{},[2680,2685,2690],{"type":27,"tag":65,"props":2681,"children":2682},{},[2683],{"type":33,"value":2684},"新项目直接使用 Nuxt 4",{"type":27,"tag":65,"props":2686,"children":2687},{},[2688],{"type":33,"value":2689},"现有项目评估迁移成本后决定",{"type":27,"tag":65,"props":2691,"children":2692},{},[2693],{"type":33,"value":2694},"关注官方迁移指南的更新",{"type":27,"tag":46,"props":2696,"children":2697},{},[],{"type":27,"tag":28,"props":2699,"children":2701},{"id":2700},"参考资源",[2702],{"type":33,"value":2700},{"type":27,"tag":61,"props":2704,"children":2705},{},[2706,2717,2727,2737],{"type":27,"tag":65,"props":2707,"children":2708},{},[2709],{"type":27,"tag":441,"props":2710,"children":2714},{"href":2711,"rel":2712},"https://nuxt.com/blog/v4",[2713],"nofollow",[2715],{"type":33,"value":2716},"Nuxt 4 官方公告",{"type":27,"tag":65,"props":2718,"children":2719},{},[2720],{"type":27,"tag":441,"props":2721,"children":2724},{"href":2722,"rel":2723},"https://nuxt.com/docs/migration/upgrade",[2713],[2725],{"type":33,"value":2726},"Nuxt 4 迁移指南",{"type":27,"tag":65,"props":2728,"children":2729},{},[2730],{"type":27,"tag":441,"props":2731,"children":2734},{"href":2732,"rel":2733},"https://nitro.unjs.io/changelog",[2713],[2735],{"type":33,"value":2736},"Nitro 2.0 更新日志",{"type":27,"tag":65,"props":2738,"children":2739},{},[2740],{"type":27,"tag":441,"props":2741,"children":2744},{"href":2742,"rel":2743},"https://github.com/nuxt/nuxt/issues",[2713],[2745],{"type":33,"value":2746},"Nuxt 路线图",{"title":7,"searchDepth":466,"depth":466,"links":2748},[2749,2750,2751,2756,2761,2766,2771,2776,2780,2784,2785],{"id":2264,"depth":469,"text":2267},{"id":2270,"depth":469,"text":2273},{"id":2286,"depth":469,"text":2289,"children":2752},[2753,2754,2755],{"id":2292,"depth":466,"text":2295},{"id":2328,"depth":466,"text":2331},{"id":2350,"depth":466,"text":2353},{"id":2365,"depth":469,"text":2368,"children":2757},[2758,2759,2760],{"id":2371,"depth":466,"text":2374},{"id":2391,"depth":466,"text":2394},{"id":2406,"depth":466,"text":2409},{"id":2421,"depth":469,"text":2424,"children":2762},[2763,2764,2765],{"id":2427,"depth":466,"text":2430},{"id":2442,"depth":466,"text":2445},{"id":2457,"depth":466,"text":2460},{"id":2472,"depth":469,"text":2475,"children":2767},[2768,2769,2770],{"id":2478,"depth":466,"text":2481},{"id":2493,"depth":466,"text":2496},{"id":2508,"depth":466,"text":2511},{"id":2534,"depth":469,"text":2537,"children":2772},[2773,2774,2775],{"id":2540,"depth":466,"text":2543},{"id":2555,"depth":466,"text":2558},{"id":2570,"depth":466,"text":2573},{"id":2585,"depth":469,"text":2588,"children":2777},[2778,2779],{"id":2591,"depth":466,"text":2594},{"id":2606,"depth":466,"text":2609},{"id":2621,"depth":469,"text":2624,"children":2781},[2782,2783],{"id":2627,"depth":466,"text":2630},{"id":2643,"depth":466,"text":2646},{"id":2658,"depth":469,"text":2661},{"id":2700,"depth":469,"text":2700},"content:topics:nuxt:nuxt4-major-updates-overview.md","topics/nuxt/nuxt4-major-updates-overview.md","topics/nuxt/nuxt4-major-updates-overview",{"_path":4,"_dir":5,"_draft":6,"_partial":6,"_locale":7,"title":8,"description":9,"date":10,"topic":5,"author":11,"tags":2790,"image":18,"imageQuery":19,"pexelsPhotoId":20,"pexelsUrl":21,"featured":6,"readingTime":22,"body":2791,"_type":478,"_id":479,"_source":480,"_file":481,"_stem":482,"_extension":483},[13,14,15,16,17],{"type":24,"children":2792,"toc":3141},[2793,2797,2801,2805,2808,2812,2816,2831,2835,2850,2853,2857,2861,2876,2880,2883,2887,2968,2972,2975,2979,2983,2998,3002,3005,3009,3013,3038,3042,3045,3049,3068,3072,3075,3079,3102,3105,3109,3113,3117],{"type":27,"tag":28,"props":2794,"children":2795},{"id":30},[2796],{"type":33,"value":8},{"type":27,"tag":35,"props":2798,"children":2799},{},[2800],{"type":33,"value":39},{"type":27,"tag":35,"props":2802,"children":2803},{},[2804],{"type":33,"value":44},{"type":27,"tag":46,"props":2806,"children":2807},{},[],{"type":27,"tag":28,"props":2809,"children":2810},{"id":51},[2811],{"type":33,"value":54},{"type":27,"tag":35,"props":2813,"children":2814},{},[2815],{"type":33,"value":59},{"type":27,"tag":61,"props":2817,"children":2818},{},[2819,2823,2827],{"type":27,"tag":65,"props":2820,"children":2821},{},[2822],{"type":33,"value":69},{"type":27,"tag":65,"props":2824,"children":2825},{},[2826],{"type":33,"value":74},{"type":27,"tag":65,"props":2828,"children":2829},{},[2830],{"type":33,"value":79},{"type":27,"tag":35,"props":2832,"children":2833},{},[2834],{"type":33,"value":84},{"type":27,"tag":61,"props":2836,"children":2837},{},[2838,2842,2846],{"type":27,"tag":65,"props":2839,"children":2840},{},[2841],{"type":33,"value":92},{"type":27,"tag":65,"props":2843,"children":2844},{},[2845],{"type":33,"value":97},{"type":27,"tag":65,"props":2847,"children":2848},{},[2849],{"type":33,"value":102},{"type":27,"tag":46,"props":2851,"children":2852},{},[],{"type":27,"tag":28,"props":2854,"children":2855},{"id":108},[2856],{"type":33,"value":111},{"type":27,"tag":35,"props":2858,"children":2859},{},[2860],{"type":33,"value":116},{"type":27,"tag":118,"props":2862,"children":2863},{},[2864,2868,2872],{"type":27,"tag":65,"props":2865,"children":2866},{},[2867],{"type":33,"value":125},{"type":27,"tag":65,"props":2869,"children":2870},{},[2871],{"type":33,"value":130},{"type":27,"tag":65,"props":2873,"children":2874},{},[2875],{"type":33,"value":135},{"type":27,"tag":35,"props":2877,"children":2878},{},[2879],{"type":33,"value":140},{"type":27,"tag":46,"props":2881,"children":2882},{},[],{"type":27,"tag":28,"props":2884,"children":2885},{"id":146},[2886],{"type":33,"value":149},{"type":27,"tag":151,"props":2888,"children":2889},{},[2890,2908],{"type":27,"tag":155,"props":2891,"children":2892},{},[2893],{"type":27,"tag":159,"props":2894,"children":2895},{},[2896,2900,2904],{"type":27,"tag":163,"props":2897,"children":2898},{},[2899],{"type":33,"value":167},{"type":27,"tag":163,"props":2901,"children":2902},{},[2903],{"type":33,"value":172},{"type":27,"tag":163,"props":2905,"children":2906},{},[2907],{"type":33,"value":177},{"type":27,"tag":179,"props":2909,"children":2910},{},[2911,2930,2949],{"type":27,"tag":159,"props":2912,"children":2913},{},[2914,2918,2922],{"type":27,"tag":186,"props":2915,"children":2916},{},[2917],{"type":33,"value":190},{"type":27,"tag":186,"props":2919,"children":2920},{},[2921],{"type":33,"value":195},{"type":27,"tag":186,"props":2923,"children":2924},{},[2925],{"type":27,"tag":200,"props":2926,"children":2928},{"className":2927},[],[2929],{"type":33,"value":205},{"type":27,"tag":159,"props":2931,"children":2932},{},[2933,2937,2941],{"type":27,"tag":186,"props":2934,"children":2935},{},[2936],{"type":33,"value":213},{"type":27,"tag":186,"props":2938,"children":2939},{},[2940],{"type":33,"value":218},{"type":27,"tag":186,"props":2942,"children":2943},{},[2944],{"type":27,"tag":200,"props":2945,"children":2947},{"className":2946},[],[2948],{"type":33,"value":227},{"type":27,"tag":159,"props":2950,"children":2951},{},[2952,2956,2960],{"type":27,"tag":186,"props":2953,"children":2954},{},[2955],{"type":33,"value":235},{"type":27,"tag":186,"props":2957,"children":2958},{},[2959],{"type":33,"value":240},{"type":27,"tag":186,"props":2961,"children":2962},{},[2963],{"type":27,"tag":200,"props":2964,"children":2966},{"className":2965},[],[2967],{"type":33,"value":249},{"type":27,"tag":35,"props":2969,"children":2970},{},[2971],{"type":33,"value":254},{"type":27,"tag":46,"props":2973,"children":2974},{},[],{"type":27,"tag":28,"props":2976,"children":2977},{"id":260},[2978],{"type":33,"value":263},{"type":27,"tag":35,"props":2980,"children":2981},{},[2982],{"type":33,"value":268},{"type":27,"tag":61,"props":2984,"children":2985},{},[2986,2990,2994],{"type":27,"tag":65,"props":2987,"children":2988},{},[2989],{"type":33,"value":276},{"type":27,"tag":65,"props":2991,"children":2992},{},[2993],{"type":33,"value":281},{"type":27,"tag":65,"props":2995,"children":2996},{},[2997],{"type":33,"value":286},{"type":27,"tag":35,"props":2999,"children":3000},{},[3001],{"type":33,"value":291},{"type":27,"tag":46,"props":3003,"children":3004},{},[],{"type":27,"tag":28,"props":3006,"children":3007},{"id":297},[3008],{"type":33,"value":300},{"type":27,"tag":35,"props":3010,"children":3011},{},[3012],{"type":33,"value":305},{"type":27,"tag":61,"props":3014,"children":3015},{},[3016,3030,3034],{"type":27,"tag":65,"props":3017,"children":3018},{},[3019,3024,3025],{"type":27,"tag":200,"props":3020,"children":3022},{"className":3021},[],[3023],{"type":33,"value":317},{"type":33,"value":319},{"type":27,"tag":200,"props":3026,"children":3028},{"className":3027},[],[3029],{"type":33,"value":325},{"type":27,"tag":65,"props":3031,"children":3032},{},[3033],{"type":33,"value":330},{"type":27,"tag":65,"props":3035,"children":3036},{},[3037],{"type":33,"value":335},{"type":27,"tag":35,"props":3039,"children":3040},{},[3041],{"type":33,"value":340},{"type":27,"tag":46,"props":3043,"children":3044},{},[],{"type":27,"tag":28,"props":3046,"children":3047},{"id":346},[3048],{"type":33,"value":349},{"type":27,"tag":61,"props":3050,"children":3051},{},[3052,3056,3060,3064],{"type":27,"tag":65,"props":3053,"children":3054},{},[3055],{"type":33,"value":357},{"type":27,"tag":65,"props":3057,"children":3058},{},[3059],{"type":33,"value":362},{"type":27,"tag":65,"props":3061,"children":3062},{},[3063],{"type":33,"value":367},{"type":27,"tag":65,"props":3065,"children":3066},{},[3067],{"type":33,"value":372},{"type":27,"tag":35,"props":3069,"children":3070},{},[3071],{"type":33,"value":377},{"type":27,"tag":46,"props":3073,"children":3074},{},[],{"type":27,"tag":28,"props":3076,"children":3077},{"id":383},[3078],{"type":33,"value":386},{"type":27,"tag":61,"props":3080,"children":3081},{},[3082,3086,3090,3094,3098],{"type":27,"tag":65,"props":3083,"children":3084},{},[3085],{"type":33,"value":394},{"type":27,"tag":65,"props":3087,"children":3088},{},[3089],{"type":33,"value":399},{"type":27,"tag":65,"props":3091,"children":3092},{},[3093],{"type":33,"value":404},{"type":27,"tag":65,"props":3095,"children":3096},{},[3097],{"type":33,"value":409},{"type":27,"tag":65,"props":3099,"children":3100},{},[3101],{"type":33,"value":414},{"type":27,"tag":46,"props":3103,"children":3104},{},[],{"type":27,"tag":28,"props":3106,"children":3107},{"id":420},[3108],{"type":33,"value":423},{"type":27,"tag":35,"props":3110,"children":3111},{},[3112],{"type":33,"value":428},{"type":27,"tag":35,"props":3114,"children":3115},{},[3116],{"type":33,"value":433},{"type":27,"tag":61,"props":3118,"children":3119},{},[3120,3127,3134],{"type":27,"tag":65,"props":3121,"children":3122},{},[3123],{"type":27,"tag":441,"props":3124,"children":3125},{"href":443},[3126],{"type":33,"value":446},{"type":27,"tag":65,"props":3128,"children":3129},{},[3130],{"type":27,"tag":441,"props":3131,"children":3132},{"href":452},[3133],{"type":33,"value":455},{"type":27,"tag":65,"props":3135,"children":3136},{},[3137],{"type":27,"tag":441,"props":3138,"children":3139},{"href":461},[3140],{"type":33,"value":464},{"title":7,"searchDepth":466,"depth":466,"links":3142},[3143,3144,3145,3146,3147,3148,3149,3150,3151],{"id":30,"depth":469,"text":8},{"id":51,"depth":469,"text":54},{"id":108,"depth":469,"text":111},{"id":146,"depth":469,"text":149},{"id":260,"depth":469,"text":263},{"id":297,"depth":469,"text":300},{"id":346,"depth":469,"text":349},{"id":383,"depth":469,"text":386},{"id":420,"depth":469,"text":423},1775975224930]