question-mark
Stuck on an issue?

Lightrun Answers was designed to reduce the constant googling that comes with debugging 3rd party libraries. It collects links to all the places you might be looking at while hunting down a tough bug.

And, if you’re still stuck at the end, we’re happy to hop on a call to see how we can help out.

super() in a method overriden via Vue.extend

See original GitHub issue

It would be great to have super() method available to be able to call parent implementation.

Issue Analytics

  • State:closed
  • Created 7 years ago
  • Reactions:14
  • Comments:10 (2 by maintainers)

github_iconTop GitHub Comments

66reactions
yyx990803commented, Jun 1, 2016
  1. This won’t be implemented in Vue.js core because I don’t want to endorse deep class inheritance.
  2. You can use this.constructor.super.options.methods.method.call(this) - this is obviously super verbose, but you can easily write a helper to shorten it to something like callSuper(this, 'methodName').
23reactions
milwormcommented, Oct 28, 2018
  1. This won’t be implemented in Vue.js core because I don’t want to endorse deep class inheritance.
  2. You can use this.constructor.super.options.methods.method.call(this) - this is obviously super verbose, but you can easily write a helper to shorten it to something like callSuper(this, 'methodName').

@yyx990803 It’s not about deep class inheritance, it’s about using “extends” property according to how it’s done everywhere and how it is described in the docs. Are you planning to remove “extends” in future releases of vue?

Read more comments on GitHub >

github_iconTop Results From Across the Web

Vue.js inheritance call parent method - Stack Overflow
No, vue doesn't work with a direct inheritance model. You can't A.extend an component, as far as I know. It's parent-child relationships ...
Read more >
Call the overrided method from extend/mixin (think 'super')
It allows you to call parent component's method just by this.$super(...arguments) in child component's method (and also in mixin's methods).
Read more >
Call super method in Vue Component - DEV Community ‍ ‍
Calling super method from Vue Component to Parent Component's method or mixin's method. It really doesn't matter.
Read more >
Extending Vue.js Components
What's the best way to "extend" a Vue component, i.e. use one component ... method override // the mixin `increment` method? increment() {...
Read more >
11.9. Using Super to call an Overridden Method
Sometimes you want the child class to do more than what a parent method is doing. You want to still execute the parent...
Read more >

github_iconTop Related Medium Post

No results found

github_iconTroubleshoot Live Code

Lightrun enables developers to add logs, metrics and snapshots to live code - no restarts or redeploys required.
Start Free

github_iconTop Related Reddit Thread

No results found

github_iconTop Related Hackernoon Post

No results found

github_iconTop Related Tweet

No results found

github_iconTop Related Dev.to Post

No results found

github_iconTop Related Hashnode Post

No results found