transition-duration.uvue 653 B

1234567891011121314151617181920212223242526272829303132333435363738394041424344
  1. <template>
  2. <view>
  3. <view :class="class"></view>
  4. <button @click="start">start</button>
  5. <button @click="reset">reset</button>
  6. </view>
  7. </template>
  8. <script>
  9. export default {
  10. data() {
  11. return {
  12. class: 'box',
  13. }
  14. },
  15. methods: {
  16. start() {
  17. this.class = 'box ani'
  18. },
  19. reset() {
  20. this.class = 'box'
  21. },
  22. jest_start(){
  23. this.start()
  24. },
  25. jest_reset(){
  26. this.reset()
  27. },
  28. }
  29. }
  30. </script>
  31. <style>
  32. .box {
  33. width: 100px;
  34. height: 100px;
  35. background-color: blue;
  36. }
  37. .ani {
  38. transition-duration: 5s;
  39. width: 200px;
  40. }
  41. </style>