We read every piece of feedback, and take your input very seriously.
To see all available qualifiers, see our documentation.
Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.
By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.
Already on GitHub? Sign in to your account
在自定义组件中canvas组件注册无效,这个因为createCanvasContext方法是有两个参数,在page页面默认传了一个this,在组件里面需要手动传this。 所以修改一下才可以在自定义组件中使用,
this.context = wx.createCanvasContext(opts.canvasId, opts.that);
The text was updated successfully, but these errors were encountered:
@liangshiwu 感谢提供的信息。 调整了代码,现在可以在自定义组件中使用了:
var Charts = function Charts(opts) { ... // this.context = wx.createCanvasContext(opts.canvasId); 为解决组件内不显示问题,替换为以下代码 this.context = opts.that ? wx.createCanvasContext(opts.canvasId, opts.that) : wx.createCanvasContext(opts.canvasId); ... }
new wxCharts({ ... that: this // 传递组件的this上下文 });
Sorry, something went wrong.
No branches or pull requests
在自定义组件中canvas组件注册无效,这个因为createCanvasContext方法是有两个参数,在page页面默认传了一个this,在组件里面需要手动传this。
所以修改一下才可以在自定义组件中使用,
this.context = wx.createCanvasContext(opts.canvasId, opts.that);
The text was updated successfully, but these errors were encountered: