fillStyle not a function(fillStyle 不是函数)
问题描述
我收到一个不寻常的错误:
I'm getting an unusual error:
ctx_wrap.fillStyle 不是函数
ctx_wrap.fillStyle is not a function
在这一行:
ctx_wrap.fillStyle('#b8b8b8');
在这里:
...
this.paint = function() {
self.path(ctx_wrap);
if (!isOver) {
ctx_wrap.fillStyle('#b8b8b8');
} else {
ctx_wrap.fillStyle('#d6d6d6');
}
ctx_wrap.fill()
ctx_wrap.stroke();
};
...
奇怪的是,如果我注释掉那行,下面的行就可以了.这两行几乎相同,但第一行产生错误,第二行有效:
What is strange is that, if I comment out that line, the line beneath works. These two lines are nearly identical, but the first one produces the error and the second one works:
ctx_wrap.fillStyle('#b8b8b8');
ctx_wrap.fillStyle('#d6d6d6');
为什么第一行会产生错误?
Why would the first line produce the error?
推荐答案
尝试使用 ctx_wrap.fillStyle = "#COLOR"
.
第二个不起作用,控制台只是停在第一个并吐出错误,因为它从代码行中吓坏了.
The second one does not work, the console just stops at the first one and spits out the error, because it freaked out from the line of code.
这篇关于fillStyle 不是函数的文章就介绍到这了,希望我们推荐的答案对大家有所帮助,也希望大家多多支持编程学习网!
本文标题为:fillStyle 不是函数


- Flexslider 箭头未正确显示 2022-01-01
- 使用RSelum从网站(报纸档案)中抓取多个网页 2022-09-06
- 失败的 Canvas 360 jquery 插件 2022-01-01
- CSS媒体查询(最大高度)不起作用,但为什么? 2022-01-01
- Quasar 2+Apollo:错误:找不到ID为默认的Apollo客户端。如果您在组件设置之外,请使用ProvideApolloClient() 2022-01-01
- 400或500级别的HTTP响应 2022-01-01
- Css:将嵌套元素定位在父元素边界之外一点 2022-09-07
- addEventListener 在 IE 11 中不起作用 2022-01-01
- 如何使用 JSON 格式的 jQuery AJAX 从 .cfm 页面输出查 2022-01-01
- Fetch API 如何获取响应体? 2022-01-01