Component中canvas的draw回调函数无法进入
2019-03-15 18:14:57
微信公开课小程序热门讨论关于「Component中canvas的draw回调函数无法进入」的小程序开发问题
补充:Component中canvas的draw回调函数无法进入
展开:当前Bug的表现Component中canvas的draw回调函数无法进入,只打印了1预期表现回调函数会进入,并打印1和2复现路径见Demo提供一个最简复现Democonstcontext=wxcreateCanvasContext(xx_canvas);contextsetFillStyle(red)contextfillRect(10,10,150,100)consolelog(1);contextdraw(false,function(e){consolelog(2);dosomethingwxcanvasToTempFilePath({x:0,y:0,width:650,height:960,canvasId:xx_canvas,fileType:png,success:function(res){letpic=restempFilePath;consolelog(pic);wxpreviewImage({urls:[restempFilePath],})}});})只打印了“1”,未打印2即速小程序:Draw回调加延时换成setTimeout就好了,代码如下constcontext=wxcreateCanvasContext(xx_canvas);contextsetFillStyle(red)contextfillRect(10,10,150,100)consolelog(1);contextdraw(false,setTimeout(function(e){consolelog(2);dosomethingwxcanvasToTempFilePath({x:0,y:0,width:650,height:960,canvasId:xx_canvas,fileType:png,success:function(res){letpic=restempFilePath;consolelog(pic);wxpreviewImage({urls:[restempFilePath],})}});},300)):draw的callback函数外面包一层等待canvas渲染的时间,不同设备有部分差异,200毫秒基本都能满足:constcontext=wxcreateCanvasContext(xx_canvas,this)wxcanvasToTempFilePath也要加上第二个参数this:再读一遍API~https:developersweixinqqcomminiprogramdevapiwxcreateCanvasContexthtml
更多有关「Component中canvas的draw回调函数无法进入」的讨论可以前往微信公开课小程序参与互动哦!
补充:Component中canvas的draw回调函数无法进入
展开:当前Bug的表现Component中canvas的draw回调函数无法进入,只打印了1预期表现回调函数会进入,并打印1和2复现路径见Demo提供一个最简复现Democonstcontext=wxcreateCanvasContext(xx_canvas);contextsetFillStyle(red)contextfillRect(10,10,150,100)consolelog(1);contextdraw(false,function(e){consolelog(2);dosomethingwxcanvasToTempFilePath({x:0,y:0,width:650,height:960,canvasId:xx_canvas,fileType:png,success:function(res){letpic=restempFilePath;consolelog(pic);wxpreviewImage({urls:[restempFilePath],})}});})只打印了“1”,未打印2即速小程序:Draw回调加延时换成setTimeout就好了,代码如下constcontext=wxcreateCanvasContext(xx_canvas);contextsetFillStyle(red)contextfillRect(10,10,150,100)consolelog(1);contextdraw(false,setTimeout(function(e){consolelog(2);dosomethingwxcanvasToTempFilePath({x:0,y:0,width:650,height:960,canvasId:xx_canvas,fileType:png,success:function(res){letpic=restempFilePath;consolelog(pic);wxpreviewImage({urls:[restempFilePath],})}});},300)):draw的callback函数外面包一层等待canvas渲染的时间,不同设备有部分差异,200毫秒基本都能满足:constcontext=wxcreateCanvasContext(xx_canvas,this)wxcanvasToTempFilePath也要加上第二个参数this:再读一遍API~https:developersweixinqqcomminiprogramdevapiwxcreateCanvasContexthtml
更多有关「Component中canvas的draw回调函数无法进入」的讨论可以前往微信公开课小程序参与互动哦!
标签:微信公开课,小程序
「Component中canvas的draw回调函数无法进入」热门讨论订阅
方法1:微信扫描微信公开课小程序码即可订阅热门讨论「Component中canvas的draw回调函数无法进入」
方法2:微信搜索微信公开课小程序名称进入,即可订阅热门讨论「Component中canvas的draw回调函数无法进入」
方法3:微信网页访问即速商店,长按识别微信公开课小程序码即可订阅热门讨论「Component中canvas的draw回调函数无法进入」
微信公开课小程序热门讨论「Component中canvas的draw回调函数无法进入」由微信公开课原创摘录于微信小程序商店shop.jisuapp.cn,转载请注明出处。
微信公开课热门讨论「Component中canvas的draw回调函数无法进入」由微信公开课开发者向微信用户提供,并对本服务内容、数据资料及其运营行为等真实性、合法性及有效性承担全部责任。
微信公开课小程序
更新时间:2019-03-15 18:14:57
>
__methodCallerx27;ofundefined
>-404011cloudfunctionexecutionerror
>,请补充选择商家自营-预付卡销售-发行方类目,并在基础信息处申请该类目,通过
>:host在模拟器中显示无效
>:请在小程序服务页面上架正式(非测试)内容或商品后重新提交审核
>.net 微信小程序 上传图片
>'setTimeout'的问题
>‘三朵里熙SPA主题减压空间’为什么搜索关键词‘三朵里‘搜不到
>‘扫普通链接二维码打开小程序‘中设置为体验版,扫码打开是线上版本
>“cloudfunctions**indexjs”gitignore
>“NO ULINK DEVICE FOUND”是怎么回事
>“万马掌上校园”的类目审核
>“上线了”公司开发的微信小程序怎么样?
>“产品是否一定需要条形码”
>