赞
踩
1, 安装插件
npm install three --save
2, 在main.js中设置一下,将three.js挂载到vue上:
- import Vue from 'vue'
-
- import * as Three from "three";
-
- Vue.prototype.$three = Three;
页面中使用:
- // 1,创建场景对象
- this.scene = new this.$three.Scene();
- // 创建缓存几何体对象
- this.geomery = new this.$three.BufferGeometry();
- // 创建环境光对象
- this.light = new this.$three.AmbientLight( 0xffffff );
- this.scene.add(this.light);
Copyright © 2003-2013 www.wpsshop.cn 版权所有,并保留所有权利。