jeudi 13 septembre 2018

Execute function when clicking on dom element in vue

I want to execute a function when I'm clicking on elements in the dom with a specific class. It just doesn't work, but I'm also recieving any error. This is my code snippet:

        methods: {
            initTab: function(){
                document.querySelectorAll('.element').onclick = this.nextTab()
            }
        },            
        mounted: function () {
            this.initTab()
        }

I I want to execute the function every time I click on the element. Would be very thankful if anybody could help me :)




Aucun commentaire:

Enregistrer un commentaire