index.vue 3.0 KB

123456789101112131415161718192021222324252627282930313233343536373839404142434445464748495051525354555657585960616263646566676869707172737475767778798081828384858687888990919293949596979899100101102103104105106107108109110
  1. <template>
  2. <view
  3. :wx:if="inited"
  4. :class="'van-transition custom-class ' + classes"
  5. :style="'-webkit-transition-duration:' + currentDuration + 'ms; transition-duration:' + currentDuration + 'ms; ' + (display ? '' : 'display: none;') + ' ' + customStyle"
  6. @transitionend="onTransitionEnd"
  7. >
  8. <slot />
  9. </view>
  10. </template>
  11. <script>
  12. import { VantComponent } from '../common/component';
  13. import { transition } from '../mixins/transition';
  14. export default {
  15. data() {
  16. return {
  17. inited: '',
  18. classes: '',
  19. display: false,
  20. currentDuration: '',
  21. customStyle: ''
  22. };
  23. },
  24. classes: ['enter-class', 'enter-active-class', 'enter-to-class', 'leave-class', 'leave-active-class', 'leave-to-class'],
  25. mixins: [transition(true)]
  26. };
  27. </script>
  28. <style>
  29. @import '../common/index.ttss';
  30. .van-transition {
  31. transition-timing-function: ease;
  32. }
  33. .van-fade-enter-active,
  34. .van-fade-leave-active {
  35. transition-property: opacity;
  36. }
  37. .van-fade-enter,
  38. .van-fade-leave-to {
  39. opacity: 0;
  40. }
  41. .van-fade-down-enter-active,
  42. .van-fade-down-leave-active,
  43. .van-fade-left-enter-active,
  44. .van-fade-left-leave-active,
  45. .van-fade-right-enter-active,
  46. .van-fade-right-leave-active,
  47. .van-fade-up-enter-active,
  48. .van-fade-up-leave-active {
  49. transition-property: opacity, -webkit-transform;
  50. transition-property: opacity, transform;
  51. transition-property: opacity, transform, -webkit-transform;
  52. }
  53. .van-fade-up-enter,
  54. .van-fade-up-leave-to {
  55. -webkit-transform: translate3d(0, 100%, 0);
  56. transform: translate3d(0, 100%, 0);
  57. opacity: 0;
  58. }
  59. .van-fade-down-enter,
  60. .van-fade-down-leave-to {
  61. -webkit-transform: translate3d(0, -100%, 0);
  62. transform: translate3d(0, -100%, 0);
  63. opacity: 0;
  64. }
  65. .van-fade-left-enter,
  66. .van-fade-left-leave-to {
  67. -webkit-transform: translate3d(-100%, 0, 0);
  68. transform: translate3d(-100%, 0, 0);
  69. opacity: 0;
  70. }
  71. .van-fade-right-enter,
  72. .van-fade-right-leave-to {
  73. -webkit-transform: translate3d(100%, 0, 0);
  74. transform: translate3d(100%, 0, 0);
  75. opacity: 0;
  76. }
  77. .van-slide-down-enter-active,
  78. .van-slide-down-leave-active,
  79. .van-slide-left-enter-active,
  80. .van-slide-left-leave-active,
  81. .van-slide-right-enter-active,
  82. .van-slide-right-leave-active,
  83. .van-slide-up-enter-active,
  84. .van-slide-up-leave-active {
  85. transition-property: -webkit-transform;
  86. transition-property: transform;
  87. transition-property: transform, -webkit-transform;
  88. }
  89. .van-slide-up-enter,
  90. .van-slide-up-leave-to {
  91. -webkit-transform: translate3d(0, 100%, 0);
  92. transform: translate3d(0, 100%, 0);
  93. }
  94. .van-slide-down-enter,
  95. .van-slide-down-leave-to {
  96. -webkit-transform: translate3d(0, -100%, 0);
  97. transform: translate3d(0, -100%, 0);
  98. }
  99. .van-slide-left-enter,
  100. .van-slide-left-leave-to {
  101. -webkit-transform: translate3d(-100%, 0, 0);
  102. transform: translate3d(-100%, 0, 0);
  103. }
  104. .van-slide-right-enter,
  105. .van-slide-right-leave-to {
  106. -webkit-transform: translate3d(100%, 0, 0);
  107. transform: translate3d(100%, 0, 0);
  108. }
  109. </style>