refactor: 重构底部导航高亮逻辑,新增跨平台兼容与工具脚本
1. 抽离底部导航归属逻辑为纯函数resolveEntryTab,优化分包页面高亮规则,对齐iOS HIG规范 2. 新增页面Tab通配符映射,简化PAGE_TAB_MAP维护 3. 修复鸿蒙平台webview返回按钮适配问题 4. 新增pages.json校验与导航标题自动注入脚本 5. 优化启动页动画性能,提升合成渲染效率 6. 修复diy-picture组件v-for缺少key的警告 7. 清理鸿蒙平台多余的分包构建配置 8. 更新统计数据与store注释说明
This commit is contained in:
108
docs/weixin-bug.md
Normal file
108
docs/weixin-bug.md
Normal file
@@ -0,0 +1,108 @@
|
||||
|
||||
## console.log
|
||||
``` log
|
||||
无效的 app.json permission["scope.userClipboard"]、app.json permission["scope.camera"]、app.json permission["scope.writePhotosAlbum"]
|
||||
pages_tool/recharge/list: 无效的 page.json ["scrollEnabled"]
|
||||
|
||||
vendor.js:3 wx.getSystemInfoSync is deprecated.Please use wx.getSystemSetting/wx.getAppAuthorizeSetting/wx.getDeviceInfo/wx.getWindowInfo/wx.getAppBaseInfo instead.
|
||||
|
||||
[pages/index/index] Some selectors are not allowed in component wxss, including tag name selectors, ID selectors, and attribute selectors.(./components/register-reward/register-reward.wxss:2:429)
|
||||
[pages/index/index] Some selectors are not allowed in component wxss, including tag name selectors, ID selectors, and attribute selectors.(./components/ns-login/ns-login.wxss:1:1448)
|
||||
[pages/index/index] Some selectors are not allowed in component wxss, including tag name selectors, ID selectors, and attribute selectors.(./components/hover-nav/hover-nav.wxss:2:304)
|
||||
[pages/index/index] Some selectors are not allowed in component wxss, including tag name selectors, ID selectors, and attribute selectors.(./components/ns-copyright/ns-copyright.wxss:1:1114)
|
||||
无效的 app.json permission["scope.userClipboard"]、app.json permission["scope.camera"]、app.json permission["scope.writePhotosAlbum"]
|
||||
pages_tool/recharge/list: 无效的 page.json ["scrollEnabled"]
|
||||
|
||||
[pages/index/index] Some selectors are not allowed in component wxss, including tag name selectors, ID selectors, and attribute selectors.(./components-diy/diy-channel-video.wxss:1:7941)
|
||||
[pages/index/index] Some selectors are not allowed in component wxss, including tag name selectors, ID selectors, and attribute selectors.(./components-diy/diy-channel-list.wxss:1:3415)
|
||||
[pages/index/index] Some selectors are not allowed in component wxss, including tag name selectors, ID selectors, and attribute selectors.(./components-diy/diy-tab.wxss:1:6056)
|
||||
[pages/index/index] Some selectors are not allowed in component wxss, including tag name selectors, ID selectors, and attribute selectors.(./components/ns-goods-sku/ns-goods-sku-category.wxss:2:67)
|
||||
[pages/index/index] Some selectors are not allowed in component wxss, including tag name selectors, ID selectors, and attribute selectors.(./components-diy/diy-category.wxss:1:8372)
|
||||
[pages/index/index] Some selectors are not allowed in component wxss, including tag name selectors, ID selectors, and attribute selectors.(./components-diy/diy-category-item.wxss:1:8672)
|
||||
[pages/index/index] Some selectors are not allowed in component wxss, including tag name selectors, ID selectors, and attribute selectors.(./components-diy/diy-bottom-nav.wxss:1:1634)
|
||||
[pages/index/index] Some selectors are not allowed in component wxss, including tag name selectors, ID selectors, and attribute selectors.(./components-diy/diy-video-list.wxss:1:7343)
|
||||
[pages/index/index] Some selectors are not allowed in component wxss, including tag name selectors, ID selectors, and attribute selectors.(./components-diy/diy-audio.wxss:1:249)
|
||||
[pages/index/index] Some selectors are not allowed in component wxss, including tag name selectors, ID selectors, and attribute selectors.(./components-diy/diy-hot-area.wxss:1:200)
|
||||
[pages/index/index] Some selectors are not allowed in component wxss, including tag name selectors, ID selectors, and attribute selectors.(./components-diy/diy-payment-qrcode.wxss:1:2077)
|
||||
[pages/index/index] Some selectors are not allowed in component wxss, including tag name selectors, ID selectors, and attribute selectors.(./components-diy/diy-quick-nav.wxss:1:447)
|
||||
[pages/index/index] Some selectors are not allowed in component wxss, including tag name selectors, ID selectors, and attribute selectors.(./components-diy/diy-member-my-order.wxss:1:385)
|
||||
[pages/index/index] Some selectors are not allowed in component wxss, including tag name selectors, ID selectors, and attribute selectors.(./components-diy/diy-member-info.wxss:6:4119)
|
||||
[pages/index/index] Some selectors are not allowed in component wxss, including tag name selectors, ID selectors, and attribute selectors.(./components-diy/diy-merch-list.wxss:1:2221)
|
||||
[pages/index/index] Some selectors are not allowed in component wxss, including tag name selectors, ID selectors, and attribute selectors.(./components-diy/diy-article.wxss:1:2941)
|
||||
[pages/index/index] Some selectors are not allowed in component wxss, including tag name selectors, ID selectors, and attribute selectors.(./components-diy/diy-goods-recommend.wxss:4:1240)
|
||||
[pages/index/index] Some selectors are not allowed in component wxss, including tag name selectors, ID selectors, and attribute selectors.(./components-diy/diy-fenxiao-goods-list.wxss:1:4000)
|
||||
[pages/index/index] Some selectors are not allowed in component wxss, including tag name selectors, ID selectors, and attribute selectors.(./components-diy/diy-live.wxss:1:146)
|
||||
[pages/index/index] Some selectors are not allowed in component wxss, including tag name selectors, ID selectors, and attribute selectors.(./components-diy/diy-float-btn.wxss:1:544)
|
||||
[pages/index/index] Some selectors are not allowed in component wxss, including tag name selectors, ID selectors, and attribute selectors.(./components-diy/diy-notes.wxss:1:2367)
|
||||
[pages/index/index] Some selectors are not allowed in component wxss, including tag name selectors, ID selectors, and attribute selectors.(./components-diy/diy-presale.wxss:1:1955)
|
||||
[pages/index/index] Some selectors are not allowed in component wxss, including tag name selectors, ID selectors, and attribute selectors.(./components-diy/diy-bargain.wxss:1:5456)
|
||||
[pages/index/index] Some selectors are not allowed in component wxss, including tag name selectors, ID selectors, and attribute selectors.(./components-diy/diy-pinfan.wxss:1:3083)
|
||||
[pages/index/index] Some selectors are not allowed in component wxss, including tag name selectors, ID selectors, and attribute selectors.(./components-diy/diy-groupbuy.wxss:1:2069)
|
||||
[pages/index/index] Some selectors are not allowed in component wxss, including tag name selectors, ID selectors, and attribute selectors.(./components-diy/diy-pintuan.wxss:1:6513)
|
||||
[pages/index/index] Some selectors are not allowed in component wxss, including tag name selectors, ID selectors, and attribute selectors.(./components-diy/diy-seckill.wxss:1:10928)
|
||||
[pages/index/index] Some selectors are not allowed in component wxss, including tag name selectors, ID selectors, and attribute selectors.(./components-diy/diy-rubik-cube.wxss:1:171)
|
||||
[pages/index/index] Some selectors are not allowed in component wxss, including tag name selectors, ID selectors, and attribute selectors.(./components-diy/diy-many-goods-list.wxss:1:963)
|
||||
[pages/index/index] Some selectors are not allowed in component wxss, including tag name selectors, ID selectors, and attribute selectors.(./components/ns-form/ns-form.wxss:1:2545)
|
||||
[pages/index/index] Some selectors are not allowed in component wxss, including tag name selectors, ID selectors, and attribute selectors.(./components/ns-goods-sku/ns-goods-sku.wxss:1:3373)
|
||||
[pages/index/index] Some selectors are not allowed in component wxss, including tag name selectors, ID selectors, and attribute selectors.(./components-diy/diy-goods-list.wxss:1:16746)
|
||||
[pages/index/index] Some selectors are not allowed in component wxss, including tag name selectors, ID selectors, and attribute selectors.(./components-diy/diy-coupon.wxss:2:1656)
|
||||
[pages/index/index] Some selectors are not allowed in component wxss, including tag name selectors, ID selectors, and attribute selectors.(./components-diy/diy-search.wxss:1:1052)
|
||||
[pages/index/index] Some selectors are not allowed in component wxss, including tag name selectors, ID selectors, and attribute selectors.(./components-diy/diy-img-ads.wxss:1:1009)
|
||||
[pages/index/index] Some selectors are not allowed in component wxss, including tag name selectors, ID selectors, and attribute selectors.(./components-diy/diy-notice.wxss:1:1282)
|
||||
[pages/index/index] Some selectors are not allowed in component wxss, including tag name selectors, ID selectors, and attribute selectors.(./components-diy/diy-text.wxss:1:9199)
|
||||
[pages/index/index] Some selectors are not allowed in component wxss, including tag name selectors, ID selectors, and attribute selectors.(./components/ns-newform/ns-newform.wxss:3:3187)
|
||||
[pages/index/index] Some selectors are not allowed in component wxss, including tag name selectors, ID selectors, and attribute selectors.(./components-diy/diy-store.wxss:1:1985)
|
||||
|
||||
[WXML Runtime warning] ./components-diy/diy-picture.wxml
|
||||
Now you can provide attr `wx:key` for a `wx:for` to improve performance.
|
||||
> 1 | <view class="diy-picture" style="{{(style)}}" data-component-name="diy-picture"><view class="fui-picture"><block wx:for="{{$root.l0}}" wx:for-item="item" wx:for-index="index"><view style="line-height:0;"><block wx:if="{{item.$orig.link.wap_url}}"><image style="width:100%;height:auto;" mode="widthFix" src="{{item.g0}}" show-menu-by-longpress="{{true}}" data-event-opts="{{[['tap',[['handlerClick',['$0'],[[['value.list','',index]]]]]]]}}" catchtap="__e"></image></block><block wx:else><image style="width:100%;height:auto;" mode="widthFix" src="{{item.g1}}" show-menu-by-longpress="{{true}}" data-event-opts="{{[['tap',[['handlerClick',['$0'],[[['value.list','',index]]]]]]]}}" catchtap="__e"></image></block></view></block></view><ns-login class="vue-ref" vue-id="103d5f85-1" data-ref="login" bind:__l="__l"></ns-login></view>
|
||||
| ^
|
||||
[Deprecation] SharedArrayBuffer will require cross-origin isolation as of M92, around July 2021. See https://developer.chrome.com/blog/enabling-shared-array-buffer/ for more details.
|
||||
```
|
||||
|
||||
## 无使用或无依赖文件
|
||||
|
||||
```
|
||||
不应存在无使用的组件
|
||||
components/mescroll/components/mescroll-empty.json
|
||||
```
|
||||
|
||||
## 模拟器与真机行为差异备忘
|
||||
|
||||
涉及 navigationBar / 标题栏 / web-view 的逻辑,必须在**真机**调试,模拟器结果不可信。
|
||||
|
||||
| 能力 / API | 真机 | 微信开发者工具模拟器 | 备注 |
|
||||
|---|---|---|---|
|
||||
| `uni.setNavigationBarTitle` | 立即生效 | **不生效**(一直存在的 bug) | 模拟器不执行本地实现 |
|
||||
| `<web-view @titleUpdate>` | 不触发 | 不触发 | mp 端不支持此事件,仅 H5 可用 |
|
||||
| navigationBar 标题来源 | `setNavigationBarTitle` 调用 / `pages.json.navigationBarTitleText` | 仅 `pages.json.navigationBarTitleText` | 模拟器无 fallback,写了也看不到 |
|
||||
| 标题初始值(H5) | `manifest.json` 的 `name` / `h5.title` | 同左 | 与 mp 无关 |
|
||||
| `<web-view @load>` (mp) | 加载成功后触发 | 触发正常 | 真机模拟器行为一致 |
|
||||
|
||||
### 已踩过的坑
|
||||
|
||||
#### 1. `webview.vue` 标题在模拟器永远显示 "加载中..."
|
||||
|
||||
**症状**:在 WeChat 开发者工具模拟器里打开 `pages_tool/webview/webview`,navigationBar 始终是 `manifest.json` 的 `"name": "加载中..."`,传 `enable_set_title=1&title=真实标题` 也没用。
|
||||
|
||||
**根因**:模拟器不执行 `uni.setNavigationBarTitle` 的本地实现,只读 `pages.json` 里的 `navigationBarTitleText`(当前为空字符串),最终落到 `manifest.json` 的 `name` 兜底。
|
||||
|
||||
**正确处理**:
|
||||
- 代码保持简单,单次 `setNavigationBarTitle` 即可,不要加 `@load` 兜底、不要加定时器重试、不要模拟器专用 workaround。
|
||||
- 必须在真机验证标题行为;模拟器结果不可信。
|
||||
|
||||
#### 2. mp 端 `<web-view>` 不会触发 `@titleUpdate`
|
||||
|
||||
**症状**:在 `pages_tool/webview/webview.vue` 里写 `@titleUpdate="updateNavbarTitle"`,期望内嵌页 `<title>` 变化时自动同步 navigationBar,但 mp 端完全不触发。
|
||||
|
||||
**根因**:WeChat `<web-view>` 原生组件不支持 `titleUpdate` 事件,`@titleUpdate` 只在 H5(uni-app 用 iframe 模拟)下生效。
|
||||
|
||||
**正确处理**:
|
||||
- mp 端标题必须由 `uni.setNavigationBarTitle` 在 `onLoad` / `onShow` 显式写入。
|
||||
- 想拿内嵌页真实 `<title>`,让内嵌页通过 jweixin 调 `wx.miniProgram.setNavigationBarTitle` 反向通知;或者干脆不用"显示内嵌页标题"这个需求,直接由 query 参数传固定标题。
|
||||
|
||||
#### 3. 不要为模拟器 bug 写 workaround
|
||||
|
||||
有些"修模拟器表现"的尝试(@load 多次重试 setNavigationBarTitle、加看门狗定时器)会让真机代码变得复杂、可能和内嵌页 `document.title` 抢控制权、引入边界 case。
|
||||
|
||||
**结论**:遇到 navigationBar / web-view 相关问题,先在真机上复现确认;只在真机还在问题再继续查代码。
|
||||
Reference in New Issue
Block a user