Business
Jobs
  • About Us
  • Solutions
    • Job Postings
      Post your job and receive qualified candidates in 48h.
    • Candidate Assessments
      500+ technical and psychological tests, plus anti-fraud.
    • Headhunting
      Tailor-made executive search from start to finish.
    • Payroll + EOR
      Payroll dispersal and EOR across 15+ LATAM countries.
  • Pricing
  • Jobs

0

151
Views
activación del evento de clic de la clase en vuejs

Estoy usando vuejs. Quiero que este método se active cada vez que se haga clic en algo con una clase específica. Tengo problemas para configurarlo en vuejs, pero funcionó correctamente con vanilla js. Por favor echa un vistazo

 new Vue({ el: "#app", data: { }, methods: { handleTileClick: function(){ alert("You have got mail") window.top.$("body").append(`<div>My Div goes here!</div>`); const tiles = document.querySelectorAll(".carousel-cell-card") tiles.forEach(tile => tile.addEventListener('click', handleTileClick)) } } })
 <script src="https://cdnjs.cloudflare.com/ajax/libs/vue/2.5.17/vue.js"></script> <div id="app"> <h2>Checklist:</h2> <p class="carousel-cell-card"> my friend bob </p> </div>

over 4 years ago · Santiago Trujillo
1 answers
Answer question

0

Debe inicializar los oyentes en la sección mounted .

 new Vue({ el: "#app", mounted() { const tiles = document.querySelectorAll(".carousel-cell-card"); tiles.forEach(tile => tile.addEventListener('click', this.handleTileClick)) }, methods: { handleTileClick(){ alert("You have got mail"); //window.top.$("body").append(`<div>My Div goes here!</div>`); // This statement has to be debugged } } })
 <script src="https://cdnjs.cloudflare.com/ajax/libs/vue/2.5.17/vue.js"></script> <div id="app"> <h2>Checklist:</h2> <p class="carousel-cell-card"> my friend bob </p> </div>

over 4 years ago · Santiago Trujillo Report
Answer question
Find remote jobs

Discover the new way to find a job!

Top jobs
Top job categories
Business
Post vacancy Pricing Sales
Legal
Terms and conditions Privacy policy
© 2026 PeakU Inc. All Rights Reserved.
Andres GPT
Show me some job opportunities
There's an error!