小程序
小游戏
企业微信
微信支付
扫描小程序码分享
这里我是用的 import * as THREE from 'three-platformize';库
当我引入renderer = new THREE.WebGLRenderer();时出现以下错误
请问有对应的解决方法吗
2 个回答
加粗
标红
插入代码
插入链接
插入图片
上传视频
<template> <view class="content"> 2 {{renderer}} </view> </template> <script setup> import * as THREE from 'three-platformize'; import { OBJLoader } from 'three-platformize/examples/jsm/loaders/OBJLoader'; import { GLTFLoader } from 'three-platformize/examples/jsm/loaders/GLTFLoader'; import { OrbitControls } from 'three-platformize/examples/jsm/controls/OrbitControls'; import { ref, reactive, computed, onMounted, getCurrentInstance, nextTick, } from 'vue' var camera, scene, renderer; var geometry, material, mesh; let innerWidth = ref(123); let innerHeight = ref(123); console.log(THREE); let currentInstance = getCurrentInstance(); const query = uni.createSelectorQuery().in(currentInstance); query.select('.content').boundingClientRect(data => { console.log("得到布局位置信息" + JSON.stringify(data)); console.log("宽" + data.width); console.log("高" + data.height); innerWidth.value = data.width; innerHeight.value = data.height; init(innerWidth.value,innerHeight.value) }).exec(); function init(innerWidth,innerHeight){ scene = new THREE.Scene(); scene.background = new THREE.Color(0x000000); camera = new THREE.PerspectiveCamera( 60, innerWidth / innerHeight, 0.1, 1000 ); // 相机坐标 camera.position.set(200, 200, 200); // 相机观察目标 camera.lookAt(scene.position); // 渲染器 renderer = new THREE.WebGLRenderer(); console.log(renderer); } </script> <style> </style>
到下面这个位置就报错了,用的是V3版本
renderer = new THREE.WebGLRenderer(); console.log(renderer);
你好,麻烦通过点击下方“反馈信息”按钮,提供出现问题的。
请具体描述问题出现的流程,并提供能复现问题的简单代码片段(https://developers.weixin.qq.com/miniprogram/dev/devtools/minicode.html)。
关注后,可在微信内接收相应的重要提醒。
请使用微信扫描二维码关注 “微信开放社区” 公众号
<template> <view class="content"> 2 {{renderer}} </view> </template> <script setup> import * as THREE from 'three-platformize'; import { OBJLoader } from 'three-platformize/examples/jsm/loaders/OBJLoader'; import { GLTFLoader } from 'three-platformize/examples/jsm/loaders/GLTFLoader'; import { OrbitControls } from 'three-platformize/examples/jsm/controls/OrbitControls'; import { ref, reactive, computed, onMounted, getCurrentInstance, nextTick, } from 'vue' var camera, scene, renderer; var geometry, material, mesh; let innerWidth = ref(123); let innerHeight = ref(123); console.log(THREE); let currentInstance = getCurrentInstance(); const query = uni.createSelectorQuery().in(currentInstance); query.select('.content').boundingClientRect(data => { console.log("得到布局位置信息" + JSON.stringify(data)); console.log("宽" + data.width); console.log("高" + data.height); innerWidth.value = data.width; innerHeight.value = data.height; init(innerWidth.value,innerHeight.value) }).exec(); function init(innerWidth,innerHeight){ scene = new THREE.Scene(); scene.background = new THREE.Color(0x000000); camera = new THREE.PerspectiveCamera( 60, innerWidth / innerHeight, 0.1, 1000 ); // 相机坐标 camera.position.set(200, 200, 200); // 相机观察目标 camera.lookAt(scene.position); // 渲染器 renderer = new THREE.WebGLRenderer(); console.log(renderer); } </script> <style> </style>
到下面这个位置就报错了,用的是V3版本
renderer = new THREE.WebGLRenderer(); console.log(renderer);
请具体描述问题出现的流程,并提供能复现问题的简单代码片段(https://developers.weixin.qq.com/miniprogram/dev/devtools/minicode.html)。