在NUXT中导入OBJLoader

时间:2018-08-05 15:15:47

标签: vue.js three.js nuxt.js

我已经在三个js上编写了小应用程序,现在我需要加载obj和mtl,但是我找不到如何在主.vue文件中导入OBJLoader.js的功能。我的示例如下:

import * as THREE from 'three';
import * as OBJLoader from '@/plugins/OBJLoader';
import * as MTLLoader from '@/plugins/MTLLoader';
import {TweenMax} from 'gsap';
let OrbitControls = require('three-orbit-controls')(THREE);
export default{
    data(){
        return {

        }
    },
    watch: {

    },
    mounted(){
        console.clear();
        //VARIABLES
        let canvas = document.getElementById('myscene');
        let width = window.innerWidth;
        let height = window.innerHeight;
        ...
        var loader_9 = new THREE.OBJLoader(); 
        loader_9.load(

             'Model/Provod.obj',

        function ( object ) {
        scene.add( object );
        });
    ...
    };

这是NUXT错误消息:

ReferenceError
THREE is not defined

和屏幕截图:

error screenshot

如何为nuxt中的三个js导入OBJLoader和其他装载程序?

感谢答案。

0 个答案:

没有答案