mirror of
https://github.com/troisjs/trois.git
synced 2024-11-24 04:12:02 +08:00
improve hmr with __hmrId
This commit is contained in:
parent
2bbdf4b04c
commit
17e334444d
@ -32,4 +32,5 @@ export default {
|
|||||||
render() {
|
render() {
|
||||||
return [];
|
return [];
|
||||||
},
|
},
|
||||||
|
__hmrId: 'PerspectiveCamera',
|
||||||
};
|
};
|
||||||
|
@ -6,4 +6,5 @@ export default {
|
|||||||
created() {
|
created() {
|
||||||
this.light = new AmbientLight(this.color, this.intensity);
|
this.light = new AmbientLight(this.color, this.intensity);
|
||||||
},
|
},
|
||||||
|
__hmrId: 'AmbientLight',
|
||||||
};
|
};
|
||||||
|
@ -6,4 +6,5 @@ export default {
|
|||||||
created() {
|
created() {
|
||||||
this.light = new DirectionalLight(this.color, this.intensity);
|
this.light = new DirectionalLight(this.color, this.intensity);
|
||||||
},
|
},
|
||||||
|
__hmrId: 'DirectionalLight',
|
||||||
};
|
};
|
||||||
|
@ -33,4 +33,5 @@ export default {
|
|||||||
render() {
|
render() {
|
||||||
return [];
|
return [];
|
||||||
},
|
},
|
||||||
|
__hmrId: 'Light',
|
||||||
};
|
};
|
||||||
|
@ -16,4 +16,5 @@ export default {
|
|||||||
created() {
|
created() {
|
||||||
this.light = new PointLight(this.color, this.intensity, this.distance, this.decay);
|
this.light = new PointLight(this.color, this.intensity, this.distance, this.decay);
|
||||||
},
|
},
|
||||||
|
__hmrId: 'PointLight',
|
||||||
};
|
};
|
||||||
|
@ -24,4 +24,5 @@ export default {
|
|||||||
created() {
|
created() {
|
||||||
this.light = new SpotLight(this.color, this.intensity, this.distance, this.angle, this.penumbra, this.decay);
|
this.light = new SpotLight(this.color, this.intensity, this.distance, this.angle, this.penumbra, this.decay);
|
||||||
},
|
},
|
||||||
|
__hmrId: 'SpotLight',
|
||||||
};
|
};
|
||||||
|
@ -27,4 +27,5 @@ export default {
|
|||||||
this.geometry = new BoxBufferGeometry(this.width, this.height, this.depth);
|
this.geometry = new BoxBufferGeometry(this.width, this.height, this.depth);
|
||||||
}
|
}
|
||||||
},
|
},
|
||||||
|
__hmrId: 'Box',
|
||||||
};
|
};
|
||||||
|
@ -22,4 +22,5 @@ export default {
|
|||||||
// this material is not mounted, it won't be auto dispose
|
// this material is not mounted, it won't be auto dispose
|
||||||
this.material.dispose();
|
this.material.dispose();
|
||||||
},
|
},
|
||||||
|
__hmrId: 'Image',
|
||||||
};
|
};
|
||||||
|
@ -41,4 +41,5 @@ export default {
|
|||||||
render() {
|
render() {
|
||||||
return this.$slots.default();
|
return this.$slots.default();
|
||||||
},
|
},
|
||||||
|
__hmrId: 'InstancedMesh',
|
||||||
};
|
};
|
||||||
|
@ -45,4 +45,5 @@ export default {
|
|||||||
render() {
|
render() {
|
||||||
return [];
|
return [];
|
||||||
},
|
},
|
||||||
|
__hmrId: 'Mesh',
|
||||||
};
|
};
|
||||||
|
@ -24,4 +24,5 @@ export default {
|
|||||||
created() {
|
created() {
|
||||||
this.geometry = new PlaneBufferGeometry(this.width, this.height, this.widthSegments, this.heightSegments);
|
this.geometry = new PlaneBufferGeometry(this.width, this.height, this.widthSegments, this.heightSegments);
|
||||||
},
|
},
|
||||||
|
__hmrId: 'Plane',
|
||||||
};
|
};
|
||||||
|
@ -17,4 +17,5 @@ export default {
|
|||||||
created() {
|
created() {
|
||||||
this.geometry = new SphereBufferGeometry(this.radius, this.widthSegments, this.heightSegments);
|
this.geometry = new SphereBufferGeometry(this.radius, this.widthSegments, this.heightSegments);
|
||||||
},
|
},
|
||||||
|
__hmrId: 'Sphere',
|
||||||
};
|
};
|
||||||
|
@ -2,9 +2,11 @@ import { toRef, watch } from 'vue';
|
|||||||
import { setFromProp } from '../tools.js';
|
import { setFromProp } from '../tools.js';
|
||||||
|
|
||||||
export default function useBindProp(comp, prop, object) {
|
export default function useBindProp(comp, prop, object) {
|
||||||
const ref = toRef(comp, prop);
|
if (comp[prop]) {
|
||||||
setFromProp(object, ref.value);
|
const ref = toRef(comp, prop);
|
||||||
watch(ref, () => {
|
|
||||||
setFromProp(object, ref.value);
|
setFromProp(object, ref.value);
|
||||||
}, { deep: true });
|
watch(ref, () => {
|
||||||
|
setFromProp(object, ref.value);
|
||||||
|
}, { deep: true });
|
||||||
|
}
|
||||||
};
|
};
|
||||||
|
Loading…
Reference in New Issue
Block a user