javascript - Vue instance not mounting on instantiation -
i using vue-loader in webpack , have vue-dialog.vue file <script>, <style> , <template>.
when import dialog './vue-dialog.vue inside file , call new vue(dialog) instance. if call .$mount() on (to mount off dom) error:
[vue warn]: failed mount component: template or render function not defined. when console.log(dialog.render) se function there, when console.log(instance.render) undefined.
if instanciate without calling .$mount() instance has no .$el property, undefined...
what missing? how else can import .vue file , call new vue() instanciate , mount have .$el element instance?
i don't think new vue(dialog) right way instantiate vue instance, instead can use vue.extend instantiating.
import dialog './dialog.vue'; // generate constructor const dialogctor = vue.extend(dialog); // generate new instance based on constructor const vm = new dialogctor(); // mount vm.$mount('#wherever');
Comments
Post a Comment