class Test {
constructor() {
console.log("Test constructor")
}
instance() {
console.log("我是实例方法")
}
static a(x: string) {
console.log(x)
}
static b(x: string) {
/**
* 1、静态方法中的this指向的是当前类
*/
new this().instance()
console.log(this)
this.a("Test.a")
console.log(x)
}
}
class Test01 extends Test {
}
Test01.b("Test01.b")
02-01
178
![](https://csdnimg.cn/release/blogv2/dist/pc/img/readCountWhite.png)