Files
bmyDI/test.ts
2024-09-27 01:24:57 +08:00

21 lines
325 B
TypeScript

import { Inject, Injectable } from "bmydi";
@Injectable()
class Demo1 {
public hello: string = "我是Demo1类"
}
class Demo2 {
@Inject()
public test!: Demo1;
public GetTest(): string {
return this.test.hello // 返回:"我是Demo1类"
}
}
var a = new Demo2();
console.log(a.GetTest());