mirror of
https://github.com/ruanyf/es6tutorial.git
synced 2025-05-24 10:22:23 +00:00
docs(decorator): fixed #1165
This commit is contained in:
parent
1b9a0ccfe0
commit
e8c2d2ea7f
@ -129,8 +129,6 @@ MyClass.isTestable // false
|
||||
|
||||
上面代码中,装饰器`testable`可以接受参数,这就等于可以修改装饰器的行为。
|
||||
|
||||
注意,装饰器对类的行为的改变,是代码编译时发生的,而不是在运行时。这意味着,装饰器能在编译阶段运行代码。也就是说,装饰器本质就是编译时执行的函数。
|
||||
|
||||
前面的例子是为类添加一个静态属性,如果想添加实例属性,可以通过目标类的`prototype`对象操作。
|
||||
|
||||
```javascript
|
||||
|
Loading…
x
Reference in New Issue
Block a user