复现代码如下:
let canvasNode = wx.createCanvas();
let ratio = 2.75;
canvasNode.width = canvasNode.width * ratio;
canvasNode.height = canvasNode.height * ratio;
context = canvasNode.getContext("2d");
context.roundRect(0, 100, 200, 50, [50, 50, 50, 50]);
在开发者工具1.06.2504060运行上述代码(重点是最后一行),不会报错,说明在开发者工具中 context.roundRect()是存在的,只是最后一个参数要求必须是数组,即使基础库是2.33.0也存在roundRect()这个方法。在微信安卓客户端(微信版本8.0.65,基础库版本3.11.2)中,运行上述代码,报错:"e.roundRect is not a function。TypeError : e.roundRect is not a function."
诉求,三选一即可:
1、既然开发者工具支持context.roundRect(),请让真机也支持context.roundRect(),这样绘制圆角矩形真的非常方便。
2、既然真机不支持context.roundRect(),那么,发者工具也不要支持context.roundRect(),避免开发者踩坑。
3、在文档中说明: HTML Canvas 2D Context 定义的哪些属性、方法,在微信小游戏、微信小程序中不被支持,比如:context.roundRect()。

真机暂未支持 但优先级不高 后续会排期支持