vue introduced global variables

1.main.js code

Here to introduce three.js example.

import * as THREE from 'three'
Vue.prototype.THREE = THREE

Use Vue.prototypeto register globals

2. References

 this.scene = new this.THREE.Scene()

Use directly in the component this.THREEto call

Published 25 original articles · won praise 1 · views 1636

Guess you like

Origin blog.csdn.net/weixin_43977647/article/details/104500587