Vue 3 migration how to do extend of a component?

Viewed 725

I have a component


const DialogMain = Vue.extend(DialogComponent);

export const alertDialog = (text: string) => {
  const dialog = new DialogMain({
    propsData: {
      type: 'alert'    
    },
  });

  return new Promise(resolve => {
    // resolve reject handle here
    }
  });

So when I migrate the app to Vue3 I get 'extend' does not exist on type 'typeof import('....') error. I know since the global Vue is no longer a new-able constructor, Vue.extend no longer makes sense in terms of constructor extension. But I am not sure how to write it with defineComponent. Is it should be like

   const dialogMain = defineComponent({extends: DialogComponent})

Will it be same as Vue.extend?

1 Answers

Have you tried to just use the component options as is?

const DialogMain = defineComponent(DialogComponent)
Related