mirror of
https://github.com/troisjs/trois.git
synced 2024-11-23 20:02:32 +08:00
created event for materials #93
This commit is contained in:
parent
72b56d123e
commit
b7fe5a6a7b
@ -19,6 +19,7 @@ export interface MaterialPublicInterface extends ComponentPublicInstance, Materi
|
||||
export const MaterialInjectionKey: InjectionKey<MaterialPublicInterface> = Symbol('Material')
|
||||
|
||||
const BaseMaterial = defineComponent({
|
||||
emits: ['created'],
|
||||
props: {
|
||||
color: { type: String, default: '#ffffff' },
|
||||
props: { type: Object as PropType<MaterialPropsInterface>, default: () => ({}) },
|
||||
@ -45,6 +46,7 @@ const BaseMaterial = defineComponent({
|
||||
// @ts-ignore
|
||||
watch(() => this.color, (value) => { material.color.set(value) })
|
||||
bindObjectProp(this, 'props', material, false, this.setProp)
|
||||
this.$emit('created', material)
|
||||
this.mesh.setMaterial(material)
|
||||
}
|
||||
},
|
||||
|
Loading…
Reference in New Issue
Block a user