Set a vue.js data from jQuery click event

Posted 3 years ago by JillzTom

I've a Vue.js instance as follows:

new Vue({
  el: '#app',
  data: {
      active: ''
  methods: {
      addActive: function(){
         $(document).on('click', '[prop-name]', function(){
                this.active = {name: $('this').attr('prop-name'), latitude: $('this').attr('prop-lat'), longitude: $('this').attr('prop-long'), icon: $('this').attr('prop-icon')};

I want to set the data active when I trigger the addActive method. But I think I'm unable to set the active like I'm doing it here. How can I do this?

Please sign in or create an account to participate in this conversation.