基类组件里写的computed,只要继承的.san子组件有设置computed都会整个覆盖掉基类的computed,不太合理 #619
HarryYin91610
started this conversation in
San
Replies: 2 comments
-
当子类的静态属性和父类的静态属性同名时(在你的例子里是 computed),子类的静态属性会把父类的静态属性覆盖掉,这是符合预期的吧?符合 JavaScript 的语法。 |
Beta Was this translation helpful? Give feedback.
0 replies
-
你是想要父类变量,现在没了对吧?在子类里面手动加一下呢? static computed = {
...ParentClass.computed,
// ...
} 这样写呢? 下次贴下代码,别截图呀。。 |
Beta Was this translation helpful? Give feedback.
0 replies
Sign up for free
to join this conversation on GitHub.
Already have an account?
Sign in to comment
-
基类组件的computed:
![截屏2021-06-15 下午5 45 45](https://user-images.githubusercontent.com/26133065/122031723-89602200-ce01-11eb-9947-befcc1d09d15.png)
子组件继承后:
![截屏2021-06-15 下午5 45 14](https://user-images.githubusercontent.com/26133065/122031638-78afac00-ce01-11eb-8d65-f016c2e7db60.png)
基类中定义的actionLinkReady被覆盖了。。
Beta Was this translation helpful? Give feedback.
All reactions