javascript - Aframe 按组件选择
问题描述
有没有办法选择所有附有特定组件的实体?
我正在尝试document.querySelectorAll(".shadow");
和其他各种组合都无济于事。
解决方案
I believe you're looking for a attribute selector - which allows grabbing HTML nodes by their attributes. a-frame components are pretty much custom made HTML attributes - you're setting them using setAttribute()
:)
In your case it would be document.querySelectorAll("[shadow]")
Check it out in this fiddle.
推荐阅读
- java - Java 复制 ArrayList 值未参考
- laravel - Connect GIATA hotel mapping with postman
- asp.net - 如何使用 C# 在引导模式中添加/获取标签和文本框对
- linux - Where can I find the definition of the function PEM_read_bio_X509()?
- c# - Group by 子句不允许在类级别上分组
- makefile - makefile 模式匹配是否可以同时包含前缀和后缀作为变量?
- unity3d - 根据 Unity 中的另一个纹理更改纹理的颜色?
- python - 在python中,哪些二元运算符可以同时具有NoneType的操作数?
- php - 在这种情况下如何使用 Laravel 存储多个数据?
- bash - 如何遍历目录并仅显示文件名