不同页面点击CanvasContext.draw,第二次点击回调不执行?

小程序 文章 2021-03-29 18:42 715 0 全屏看文

AI助手支持GPT4.0

不同页面点击CanvasContext.draw,第二次点击回调不执行?When I click CanvasContext.draw on different pages, the callback is not executed for the second click?

不同页面点击CanvasContext.draw,第二次点击回调不执行?

在自定义tabbar里设计了中心按钮,点击绘制二维码。在首页的tab页下点击可以正常回调与绘制,可是在个人中心的tab页下点击却不执行回调。尝试将首页与个人中心调换位置,结果个人中心可以回调,首页不可以回调。就是说第二个页面始终无法回调。

在网上找到一些方法,把draw的回调加上延时,但加上延时之后canvasToTempFilePath会报错fail canvas is empty。

请求解决方法!急!!!!!

The center button is designed in the custom tabbar, and click to draw the QR code. Click under the tab page of the home page to call back and draw normally, but click under the tab page of the personal center to not execute the call back. Try to change the position between the home page and the personal center. As a result, the personal center can call back, but the home page cannot. That is to say, the second page can never be called back. Find some methods on the Internet to add delay to the callback of draw, but after adding delay, canvastotempfilepath will report an error: fail canvas is empty. Request a solution! Urgent!!!!!

回答:

赤赤:

这是tabbar中心按钮调用的函数

这是引入的js文件里的draw函数

如果是第一个tab页点击可以产生回调,但第二个页面再点击打印数据到aaaaa就停止了。

tabbar中心按钮的点击事件是固定写死的,按理说无论在哪个页点击触发的都是同一个点击事件,对应着的都是这个函数。

两个页面点击触发完全一致,但第二个页面就是无法进入回调。

求大神支招!

武曲心:

按着报错一步步外上查原因,你别没检测就拿问题出来问,这么描述也不放代码片段,帮不了你。

赤赤:emm这位兄台怎么这么让人火大,问问题的平台还不能发问题了?

-EOF-

AI助手支持GPT4.0