SmartAssiter-Discard/docs/修改记录_2026-09-04_BLE连接ASI分号修复.md

19 lines
843 B
Markdown
Raw Permalink Blame History

This file contains ambiguous Unicode characters

This file contains Unicode characters that might be confused with other characters. If you think that this is intentional, you can safely ignore this warning. Use the Escape button to reveal them.

# 修改记录 2026-09-04:修复 ASI 导致 BLE 连接调用失效
## 问题现象
点击设备列表连接、CLI 页点 connect 均无反应,控制台报
`TypeError: setMac(...) is not a function` / `pushMsg(...) is not a function`。
## 根因
`pages/tabbar/home.vue:230` 与 `pages/bleTest/bluetoothOperation/bluetoothOperation.vue:147`
两处,前一行语句末尾没有分号,下一行又以 `(` 开头(`(getApp().globalData as any).ConnectBle(...)`),
JavaScript 自动分号插入(ASI)对此不生效,编译产物把两行合并成
`setMac(...)(getApp()...)` —— 拿上一行的返回值(undefined)当函数调用。
## 修改
两处行末补分号。排查技巧:源码函数明明存在却报 "is not a function" 时,
到 `unpackage/dist/dev/app-plus/app-service.js` 搜编译产物即可定位。