I'm using single file components
, but I can not access a component via another component, here's what I've tried ...
<template>
<div id="containerPrincipal" @click.stop="teste">
...
<template>
<script>
/*Outro componente*/
import flex_div from './elementos/Div.vue'
export default {
name: 'containerPrincipal',
methods : {
teste () {
componente = new flex_div().$mount();
console.log(componente);
}
},
components: {
flex_div
}
}
</script>
Error
_Div2.default is not a constructor
How can I resolve this?
Edit
Div.vue
<template>
<div id="flexdiv" @click.stop="opcoes">
...
</template>
<script>
export default {
name: 'flexdiv',
data () {
return {
modal : false,
eventMod : false,
elMod : false,
}
},
methods : {
opcoes (event) {
if(this.modal === true) {this.modal = false;}
else {this.elMod = event.target; this.eventMod = event; this.modal = true;}
}
<style scoped>
#flexdiv {
background: #424242;
height: 200px;
width: 400px;
}
</style>