-
Notifications
You must be signed in to change notification settings - Fork 150
New issue
Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.
By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.
Already on GitHub? Sign in to your account
增加 instance.$destroy 方法 #221
Labels
Comments
bingo !! 之前也想了 主要是前向兼容的问题。 $destory(){
this.destory();
// other distroy logic 内建的
} 这样就不需要考虑 |
#221 看这个issue |
原来之前已经提过了 or2 |
我的想法是新增生命周期。 这样新版本就使用recycle, 也可以使用 destroy + supr, 不需要任何的upgrade操作。 同时增加更加一致性的 |
这样也可以,给 destroy 加个 deprecated warning,尽量用新的 recycle 生命周期~ |
Sign up for free
to join this conversation on GitHub.
Already have an account?
Sign in to comment
一般组件实例上的方法都是以 $ 开头的,比如 $watch、$emit、$update
但是销毁的方法却没有 $ 前缀,感觉用的时候会搞混
regular/lib/render/client.js
Lines 315 to 341 in 6e18c7b
这里的 destroy 和 config/init 应该是同样性质的,都是生命周期钩子,文档应该写在生命周期那个章节,但是同时它又会被当做方法来调用(比如在路由的场景下,组件不需要 cache 的话,就会主动 destroy)
https://regularjs.github.io/reference/
文档中的实例方法也没有提到 destroy,所以是不是可以考虑加个 $destroy 方法呢
The text was updated successfully, but these errors were encountered: