programing

Vue 3 마이그레이션 구성 요소의 확장 방법

prostudy 2022. 5. 7. 09:33
반응형

Vue 3 마이그레이션 구성 요소의 확장 방법

나는 구성 요소가 있다.


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
    }
  });

그래서 내가 앱을 Vue3로 마이그레이션할 때 나는'extend' does not exist on type 'typeof import('....')오류. 글로벌 Vue는 더 이상 새로운 생성자가 아니기 때문에 Vue.extend는 더 이상 생성자 확장 측면에서 의미가 없다는 것을 알고 있다.그러나 나는 그것을 어떻게 정의구성요소로 쓰는지 잘 모르겠다.이렇게 해야 하나?

   const dialogMain = defineComponent({extends: DialogComponent})

Vue.extend와 같을까?

구성 요소 옵션을 그대로 사용해보셨습니까?

const DialogMain = defineComponent(DialogComponent)

참조URL: https://stackoverflow.com/questions/69794998/vue-3-migration-how-to-do-extend-of-a-component

반응형