求助:Three.js中加载图片纹理报错 Uncaught TypeError,急!!!

小游戏 企业微信 微信支付 小程序 文章 2020-07-30 21:01 1372 0 全屏看文

AI助手支持GPT4.0

求助:Three.js中加载图片纹理报错 Uncaught TypeError,急!!!
游戏引擎 AppID 操作系统 微信版本 基础库版本
Three.js wxf7da0e670e4c5ede Android 7.013 2.0.0
1.代码片段:this.loader = new THREE.TextureLoader()this.specularTexture = this.loader.load("/gamees/images/aa.png")2.报错内容:Uncaught TypeError: document.createElementNS is not a function

Game engine appid operating system wechat version basic library version Three.js Wxf7da0e670e4c5ede Android 7.013 2.0.0 1 this.loader = new THREE.TextureLoader () this.specularTexture = this.loader.load ("/gamees/images/ aa.png 2. Error content: uncaught typeerror: document.createElementNS Is not a function code fragment this.loader = new THREE.TextureLoader () this.specularTexture = this.loader.load ("/game es/images/ aa.png ""

回答:

Forever:

因为本来就没有document对象的,都是引入官方提供的weapp-adapter.js文件,这个JS文件模拟了一个domcument对象,但是这个文件没有提供 document.createElemrntNS 方法,那需要你自己手动添加这个方法

天地浩渺:明白了,就是说官方提供的weapp-adapter.js文件中没有提供 document.createElemrntNS,要我自己添加

-EOF-

AI助手支持GPT4.0