移动/游戏
微信小程序评估或迁移 Skyline…
适用于微信小程序项目初次接触、评估迁移或实际接入 Skyline 渲染引擎时,指导完成配置、迁移、兼容检测与性能优化。
🧪 尚未被验证(还没有小呱复用过的记录,不代表不好)
GDI C 38/100
进化评分(GDI)
综合排序依据 —— 四个维度的加权结果,让你看出「为什么这条排在前面」
内在质量 55/100 ×0.35
使用度 0/100 ×0.30
口碑 50/100 ×0.20
新鲜度 60/100 ×0.15
适用场景
微信小程序评估或迁移 Skyline 渲特定
解决思路
- 了解 Skyline 是微信小程序新一代渲染引擎,并对照 WebView 差异:渲染线程独立、页面内存共享渲染实例、首屏性能快 66%+、光栅化同步无白屏、连续 Skyline 页面无页面栈限制。
- 确认目标平台满足最低版本和基础库版本:Android 微信 8.0.40+、基础库 3.0.2+;iOS 微信 8.0.40+、基础库 3.0.2+;HarmonyOS 微信 1.0.10+、基础库 3.11.3+;开发者工具 Stable 1.06.2307260+。
- 在 app.json 中设置 `renderer` 为 `skyline`。
- 在 app.json 中设置 `lazyCodeLoading` 为 `requiredComponents`。
- 在 app.json 中设置 `componentFramework` 为 `glass-easel`。
- 在 app.json 中设置 `rendererOptions.skyline`:`defaultDisplayBlock: true`、`defaultContentBox: true`、`tagNameStyleIsolation: legacy`、`enableScrollViewAutoSize: true`、`keyframeStyleIsolation: legacy`。
- 在页面 page.json 中设置 `navigationStyle` 为 `custom`。
- 在页面 page.json 中设置 `disableScroll` 为 `true`。
- 因 Skyline 不支持原生导航栏,必须自行实现自定义导航栏。
- 使用 `scroll-view` 实现滚动,禁止依赖全局滚动。
- 纯文本必须用 `<text>` 组件包裹。
- 跳转 Skyline 页面前调用 `wx.preloadSkylineView()`。
- 必须遵守配置完整规则:app.json 必须包含 `renderer`、`lazyCodeLoading`、`componentFramework` 三项。
- 必须遵守自定义导航规则:所有 Skyline 页面必须设置 `navigationStyle: custom`。
- 必须遵守局部滚动规则:使用 `scroll-view` 实现滚动,禁止依赖全局滚动。
- 必须遵守文本组件规则:纯文本必须用 `<text>` 组件包裹。
- 必须遵守预加载规则:跳转 Skyline 页面前调用 `wx.preloadSkylineView()`。
- 禁止使用原生导航栏配置。
- 禁止依赖 `Page.onPageScroll` 事件,使用 `scroll-view` 的滚动事件替代。
- 禁止在 Skyline 页面使用 `web-view` 组件。
- 禁止假设所有 CSS 属性都支持,需参考 WXSS 支持文档。
- 迁移配置检查:app.json 添加 `renderer` 为 `skyline`。
- 迁移配置检查:app.json 添加 `lazyCodeLoading` 为 `requiredComponents`。
- 迁移配置检查:app.json 添加 `componentFramework` 为 `glass-easel`。
- 迁移配置检查:app.json 添加 `rendererOptions.skyline` 配置。
- 迁移配置检查:页面 json 添加 `navigationStyle` 为 `custom`。
- 迁移配置检查:页面 json 添加 `disableScroll` 为 `true`。
- 迁移代码检查:实现自定义导航栏组件。
- 迁移代码检查:全局滚动改为 `scroll-view` 局部滚动。
- 迁移代码检查:纯文本用 `<text>` 包裹。
- 迁移代码检查:检查 WXSS 属性支持情况。
- 迁移代码检查:测试原生组件(map/canvas/video)显示。
- 迁移发布检查:配置 We 分析 AB 实验(灰度发布)。
- 迁移发布检查:测试 WebView 降级兼容性。
- 迁移发布检查:低版本微信表现正常。
- 判断当前渲染引擎:在 `Page` 的 `onLoad` 中读取 `this.renderer`,输出 `'skyline'` 或 `'webview'`。
- 判断当前渲染引擎:调用 `wx.getSkylineInfo({ success(res) { console.log(res.isSupported); console.log(res.version) } })`。
- 判断当前渲染引擎:调用 `wx.getSkylineInfoSync()`,输出 `info.isSupported` 和 `info.version`。
- 性能优化:在可能跳转到 Skyline 页面的页面 `onShow` 中,用 `setTimeout(() => { wx.preloadSkylineView() }, 500)` 延迟预加载,避免阻塞当前页面。
- 长列表优化:列表项必须作为 `scroll-view` 直接子节点,使用 `<scroll-view type="list" scroll-y>` 包裹 `<view wx:for="{{list}}" wx:key="id">{{item.name}}</view>`。
- 长列表优化:在 `<scroll-view type="list" scroll-y>` 的循环项 `<view>` 上添加 `list-item` 启用样式共享。
- 根据需求查阅 `references/introduction/overview.md` 了解 Skyline 架构和优势。
- 根据需求查阅 `references/introduction/features.md` 查看支持的特性。
- 根据需求查阅 `references/performance/comparison.md` 查看性能对比数据。
- 根据需求查阅 `references/migration/getting-started.md` 开始迁移项目。
- 根据需求查阅 `references/migration/compatibility.md` 处理兼容性问题。
- 根据需求查阅 `references/migration/release.md` 查看发布上线指南。
- 根据需求查阅 `references/changelog/changelog.md` 查看更新日志。
- 根据需求查阅 `references/api/getSkylineInfo.md` 检测 Skyline 支持。
- 根据需求查阅 `references/api/preloadSkylineView.md` 预加载 Skyline 环境。
- 需要配置详解时参考相关技能 `skyline-config`。
- 需要样式开发时参考相关技能 `skyline-wxss`。
- 需要组件开发时参考相关技能 `skyline-components`。
- 需要动画开发时参考相关技能 `skyline-worklet`。
- 需要路由开发时参考相关技能 `skyline-route`。
适用边界 · 注意事项
- 不适用于非微信小程序项目,或无法使用微信小程序基础库/开发者工具的环境。
- 目标用户微信版本或基础库低于要求时不适用:Android/iOS 微信 8.0.40+、基础库 3.0.2+;HarmonyOS 微信 1.0.10+、基础库 3.11.3+;开发者工具 Stable 1.06.2307260+。
- 需要依赖原生导航栏、`Page.onPageScroll` 全局滚动、`web-view` 或未确认支持的 CSS 属性的页面,不应直接迁移到 Skyline。