[英]P5 DOM function 'select' is not being found, even though I've imported p5.dom.js
Here is my HTML :这是我的HTML :
<script type="text/javascript" src="{{ url_for('static', filename='lib/p5.js') }}"></script>
<script type="text/javascript" src="{{ url_for('static', filename='lib/p5.dom.js') }}"></script>
<script type="text/javascript" src="{{ url_for('static', filename='js/grid.js') }}?{{version_num}}"></script>
The first two imports don't throw an error.前两个导入不会引发错误。 My setup() function in grid.js does, however.但是,我在 grid.js 中的 setup() 函数确实如此。
part of grid.js grid.js 的一部分
function setup() {
smooth();
canvas = createCanvas(windowWidth, windowWidth * 3/2);
textAlign(CENTER, CENTER);
textSize(fontSize);
frameRate(32);
fill(0, 0, 0, 40);
inputs = select('.word_entry');
console.log(inputs)
}
Yet, when I try and call the built in select
function of p5.dom.js, I get this error.但是,当我尝试调用 p5.dom.js 的内置select
函数时,出现此错误。 What's going on??这是怎么回事??
Error message错误信息
Uncaught ReferenceError: select is not defined
at setup (grid.js?1.0.3:17)
at p5.<anonymous> (p5.js:217)
at p5.<anonymous> (p5.js:190)
at new p5 (p5.js:342)
at _globalInit (p5.js:5761)
Edit: Don't mind the url_for syntax, that's just flask.编辑:不要介意 url_for 语法,那只是烧瓶。 I'm sure that lib/p5.dom.js is being loaded, because placing it before the lib/p5.js throws an error.我确定 lib/p5.dom.js 正在加载,因为将它放在 lib/p5.js 之前会引发错误。
我仍然很好奇出了什么问题,但我通过下载 P5 的“完整”版本并去掉 p5.dom.js 导入行来解决这个问题。
声明:本站的技术帖子网页,遵循CC BY-SA 4.0协议,如果您需要转载,请注明本站网址或者原文地址。任何问题请咨询:yoyou2525@163.com.