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

119
Views
vue: la rotación de transformación no gira hacia atrás cuando se cambia el estado

Cuando hago clic en el botón, se alternará el estado showMore . ingrese la descripción de la imagen aquí

Si hago clic en él la primera vez, gira como se esperaba.
Pero cuando vuelvo a hacer clic en el botón, la animación no funciona.

aplicación.vue

 <template> <div class="item"> <button class="learn-more-btn" @click="toggleShow"> <span>Rotate</span> <img src="./assets/logo.png" alt="arrow" :class="arrowLeft" width="50" height="50" /> </button> </div> </template> <script> export default { components: {}, data() { return { showMore: false, }; }, methods: { toggleShow() { this.showMore = !this.showMore; }, }, computed: { arrowLeft() { let arrow = "turn-arrow"; if (this.showMore === true) { return arrow; } return true; }, }, }; </script> <style scoped lang="scss"> .item { display: flex; border: 1px solid grey; width: 150px; .learn-more-btn { display: flex; justify-content: center; align-items: center; background-color: transparent; border: none; &:hover { cursor: pointer; } img { display: inline-block; } .turn-arrow { -moz-transform: rotate(180deg); -ms-transform: rotate(180deg); -webkit-transform: rotate(180deg); transform: rotate(180deg); transition: all 3000ms; } span { padding: 0 0.5rem; } } } </style>

Códigosycaja:
https://codesandbox.io/s/headless-fire-ng001?file=/src/App.vue

about 4 years ago · Juan Pablo Isaza
1 answers
Answer question

0

Acabo de refactorizar un poco tu código y simplifiqué las cosas.

En lugar de usar transitions , las reemplacé con animations y cambié entre las .rotate-down y .rotate-up que usan estas animaciones.

Échale un vistazo: https://codesandbox.io/s/wonderful-wescoff-icnnm?file=/src/App.vue

Espero que sea útil :)!

about 4 years ago · Juan Pablo Isaza 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!