mirror of
https://github.com/troisjs/trois.git
synced 2024-11-24 04:12:02 +08:00
hmr unmounted : remove object from scene
This commit is contained in:
parent
fd4807a6bb
commit
816a38d1fd
@ -46,6 +46,9 @@ export default {
|
|||||||
this.scene.add(this.light);
|
this.scene.add(this.light);
|
||||||
if (this.light.target) this.scene.add(this.light.target);
|
if (this.light.target) this.scene.add(this.light.target);
|
||||||
},
|
},
|
||||||
|
unmounted() {
|
||||||
|
this.scene.remove(this.light);
|
||||||
|
},
|
||||||
render() {
|
render() {
|
||||||
return [];
|
return [];
|
||||||
},
|
},
|
||||||
|
@ -38,6 +38,9 @@ export default {
|
|||||||
this.mesh.receiveShadow = this.receiveShadow;
|
this.mesh.receiveShadow = this.receiveShadow;
|
||||||
this.scene.add(this.mesh);
|
this.scene.add(this.mesh);
|
||||||
},
|
},
|
||||||
|
unmounted() {
|
||||||
|
this.scene.remove(this.mesh);
|
||||||
|
},
|
||||||
render() {
|
render() {
|
||||||
return this.$slots.default();
|
return this.$slots.default();
|
||||||
},
|
},
|
||||||
|
@ -23,6 +23,7 @@ export default {
|
|||||||
},
|
},
|
||||||
unmounted() {
|
unmounted() {
|
||||||
if (this.geometry) this.geometry.dispose();
|
if (this.geometry) this.geometry.dispose();
|
||||||
|
if (this.mesh) this.scene.remove(this.mesh);
|
||||||
},
|
},
|
||||||
methods: {
|
methods: {
|
||||||
initMesh() {
|
initMesh() {
|
||||||
|
@ -23,6 +23,7 @@ export default {
|
|||||||
unmounted() {
|
unmounted() {
|
||||||
this.texture.dispose();
|
this.texture.dispose();
|
||||||
this.material.dispose();
|
this.material.dispose();
|
||||||
|
this.scene.remove(this.sprite);
|
||||||
},
|
},
|
||||||
methods: {
|
methods: {
|
||||||
onLoaded() {
|
onLoaded() {
|
||||||
|
Loading…
Reference in New Issue
Block a user