更新之后出现perty or method "toJSON" is not defined 报错?
发布于 5 年前 作者 tao15 429 次浏览 来自 问答

使用uView的u-circle-progress组件,uni.createCanvasContext(this.elBgId, this)导致报这个错误

3 回复
问题依然存在
drawProgressBg() {
			let ctx = uni.createCanvasContext(this.elBgId, this);
			ctx.setLineWidth(this.borderWidthPx); // 设置圆环宽度
			ctx.setStrokeStyle(this.inactiveColor); // 线条颜色
			ctx.beginPath(); // 开始描绘路径
			// 设置一个原点(110,110),半径为100的圆的路径到当前路径
			let radius = this.widthPx / 2;
			ctx.arc(radius, radius, radius - this.borderWidthPx, 0, 2 * Math.PI, false);
			ctx.stroke(); // 对路径进行描绘
			ctx.draw();
	},
uni.createCanvasContext(this.elBgId, this)把this去了就不报错了,但是绘制不了了

请具体描述问题出现的流程,并提供能复现问题的简单代码片段(https://developers.weixin.qq.com/miniprogram/dev/devtools/minicode.html),并提供下工具的版本号。

把开发工具的本地 包重新选下,我昨天也遇到了:

https://developers.weixin.qq.com/community/develop/doc/0004c68aae40288f147bcd3415b000

回到顶部