How to get the value of the no Vue?

3

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.

    
asked by anonymous 26.07.2017 / 16:56

1 answer

5

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>
    
26.07.2017 / 17:08