4

The import is working just fine in case I try to use the component from element-plus directly.

What I'm trying to do though, is to extend a component from element-plus library (it uses the composition api from Vue 3) and add some additional properties to my component and methods.

In Vue 2 it would look something like this:

export default {
  extends: SomeComponent
}

In Vue 3 this seems to not be working anymore.

I've read about defineComponent but so far, without success implementing it.

Can someone shed me some lights? Thanks.

3
  • 1
    I want to extend an ElementPlus component and then use my component which will have some additional stuff Commented Mar 3, 2022 at 8:16
  • Hi @pmpc did you find a way for this issue ? I am also having the same problem now. how can we extend 'El Tree' component in custom component ? Commented Aug 24, 2022 at 2:54
  • Yes @SandyKrish. Please check my answer below Commented Aug 25, 2022 at 9:23

1 Answer 1

8

In order to extend a component that uses Composition API whereas another still uses Options API, we need to also do the setup, such as:

export default { extends: SomeComponent, setup: SomeComponent.setup }

Sign up to request clarification or add additional context in comments.

1 Comment

This worked in Nuxt 3. Thanks

Your Answer

By clicking “Post Your Answer”, you agree to our terms of service and acknowledge you have read our privacy policy.

Start asking to get answers

Find the answer to your question by asking.

Ask question

Explore related questions

See similar questions with these tags.