微信截图的问题

在微信开发者工具里,这样截图没问题,但是真机不行,就卡一阵子,然后就没然后了
cc.director.once(cc.Director.EVENT_AFTER_DRAW, function () {
let data = canvas.toDataURL();
let img = new Image(cc.visibleRect.width, cc.visibleRect.height);
img.src = data;
img.onload = function () {
let tex = new cc.Texture2D();
tex.initWithElement(img);
tex.handleLoadedTexture()
this.brocastMessage(CTCApi.OPEN_CAPTURE_PANLE, tex);
}.bind(this);
}.bind(this));