不用管量出的数值准不准确。你只要计算方法正确,把它渲染到实际中就是准确的。比如固定定位标题居中,就是top =(top+bottom)/2; left = width / 2 ;然后用transform。亲测,量出来也是不准确,但是实际渲染是没问题的。
wx.getMenuButtonBoundingClientRect()获取的属性,top值不准确[图片][图片][图片] 测试屏幕参数iphone6/7/8,在默认模式下,获取screenHeight为667px,windowHeight为603px,statusBarHeight为20px,计算顶部导航栏高度为44px,(44-32(胶囊高度))/2 = 6px (即胶囊距离状态栏底部的距离), 但是wx.getMenuButtonBoundingClientRect()获取的top值t为24px,24-20(状态栏高度) = 4px (即胶囊距离状态栏底部的距离) 真机和编辑器都出现问题 安卓 ios 都有 计算差值对应不起来
2022-03-10电脑端,直接用开发者工具,或者用电脑端的小程序可以正常调用
真机调试,调用ocrText云函数,向其传buffer时,图片几十k就就导致调用云函数超时如果换成图片很小的,几k的大小就可以正确调用云函数。 WAServiceMainContext.js:2 (in promise) MiniProgramError cloud.callFunction:fail -404012 polling exceed max timeout retry. (callId: 1646458468314-0.7419272625279247) (trace: 13:34:28 start->13:34:28 app show->13:34:43 timeout, retry->13:34:58 app hide->13:34:58 timeout, retry->13:35:2 app show->13:35:4 app hide->13:35:13 timeout, abort) Error: cloud.callFunction:fail -404012 polling exceed max timeout retry. (callId: 1646458468314-0.7419272625279247) (trace: 13:34:28 start->13:34:28 app show->13:34:43 timeout, retry->13:34:58 app hide->13:34:58 timeout, retry->13:35:2 app show->13:35:4 app hide->13:35:13 timeout, abort) at S (WASubContext.js:2:242573) at Function.<anonymous> (WASubContext.js:2:265437) at Generator.next (<anonymous>) at n (WASubContext.js:2:2196) at s (WASubContext.js:2:2399) https://developers.weixin.qq.com/miniprogram/dev/api-backend/open-api/ocr/ocr.printedText.html
2022-03-05