I have the variable Vue:
var appExemplo = new Vue({
el: "#appExemplo"
});
How can I get the value that is in el
? In this example it would be #appExemplo
.
This.el
returns undefined.
I have the variable Vue:
var appExemplo = new Vue({
el: "#appExemplo"
});
How can I get the value that is in el
? In this example it would be #appExemplo
.
This.el
returns undefined.
Do you want to get DOM
handled by vue
?
You can use the $el
property
var appExemplo = new Vue({
el: "#appExemplo",
data: {
message: 'Hello World!'
}
});
console.log(appExemplo.$el.id, appExemplo.$el);
<script src="https://cdnjs.cloudflare.com/ajax/libs/vue/2.4.2/vue.min.js"></script><divid="appExemplo">
{{ message }}
</div>