已解决,有两种办法解决。
真机报错:Error during evaluating file "app.js",是什么原因?我小程序代码1个月都没用动过了。但是今天运行之后,模拟器没问题。iOS和Android都报错。错误如下: [图片] 后续补充,以下是我的解决办法: # 问题记录 ## 问题记录-01 - 问题:真机运行,出现: ```log `length` must be a positive 32-bit integer Error during evaluating file "app.js": ``` 无论是更改小程序基础库,还是 - 探索 出问题的地方是,通过HbuilderX,编译后形成的common/vendor.js以下代码: ```js module.exports = function setFunctionLength(fn, length) { if (typeof fn !== 'function') { throw new $TypeError('`fn` is not a function'); } if (typeof length !== 'number' || length < 0 || length > 0xFFFFFFFF || $floor(length) !== length) { // throw new $TypeError('`length` must be a positive 32-bit integer'); return fn //此处更改 } /***以下代码省略***/ return fn; }; ``` 在报错的地方打日志,发现是解析一个叫:apply的方法有错代码如下: ```js // var $reflectApply = GetIntrinsic('%Reflect.apply%', true) || bind.call($call, $apply); var $reflectApply=Reflect.apply //此处更改 var $defineProperty = __webpack_require__(/*! es-define-property */ 51); var $max = GetIntrinsic('%Math.max%'); module.exports = function callBind(originalFunction) { if (typeof originalFunction !== 'function') { throw new $TypeError('a function is required'); } var func = $reflectApply(bind, $call, arguments); return setFunctionLength( func, 1 + $max(0, originalFunction.length - (arguments.length - 1)), true ); }; ``` 在小程序中,似乎"$max方法不生效" - 最终解决办法 使用原始的yarn.lock,删除掉node_modules,再次执行yarn。 详细调查是引用的call-bind这个库更新导致set-function-length判断异常。
2024-08-19routeDone with a webviewId 2 that is not the current page
routeDone with a webviewId 133 that is not ?routeDone with a webviewId 133 that is not the current page 项目一打开就报这个
2024-01-18已解决!
wx.onBLECharacteristicValueChange不能进去回调?wx.notifyBLECharacteristicValueChange({ //启用 wx.notifyBLECharacteristicValueChange state: true, type: 'notification', deviceId: deviceId, serviceId: uuid, characteristicId: notifyCharacteristicId, success: (res) => { console.log(res) // 操作之前先监听,保证第一时间获取数据 wx.onBLECharacteristicValueChange((result) => { console.log('获取数据,未解析前', result) let value = this.ab2hex(result.value) console.log('获取数据', value) // 使用完成后在合适的时机断开连接和关闭蓝牙适配器 wx.closeBLEConnection({ deviceId }) wx.closeBluetoothAdapter() }) }, fail(res) { console.log(res) } })
2022-10-31