programing

인스턴스화 시 Vue 인스턴스가 마운트되지 않음

copyandpastes 2022. 7. 30. 21:15
반응형

인스턴스화 시 Vue 인스턴스가 마운트되지 않음

사용하고 있다vue-loader웹 팩에 저장하여vue-dialog.vue에 철하다.<script>,<style>그리고.<template>.

할 때import dialog from './vue-dialog.vue다른 파일 내 및 콜new Vue(dialog)예를 들어보자.하지만 내가 전화하면.$mount()(DOM에서 마운트하기 위해) 에러가 표시됩니다.

 [Vue warn]: Failed to mount component: template or render function not defined.

할 때console.log(dialog.render)이 기능을 사용할 때console.log(instance.render)그것의.undefined.

내가 전화하지 않고 설치한다면.$mount()인스턴스에는 없습니다..$el프로퍼티, 그undefined...

제가 무엇을 빠뜨리고 있나요?다른 방법으로 Import를 하려면.vue파일을 다른 사람에게 전송하여 호출하다new Vue()설치 후 마운트할 수 있습니다..$el인스턴스에서 요소를 제거하시겠습니까?

난 그렇게 생각하지 않아.new Vue(dialog)를 사용하여 vue 인스턴스를 인스턴스화하는 것이 좋습니다.

import dialog from './dialog.vue';
// generate a constructor
const dialogCtor = Vue.extend(dialog);
// generate a new instance based on the constructor
const vm = new dialogCtor();
// then mount it
vm.$mount('#wherever');

언급URL : https://stackoverflow.com/questions/45694121/vue-instance-not-mounting-on-instantiation

반응형