clock.vue 3.1 KB

123456789101112131415161718192021222324252627282930313233343536373839404142434445464748495051525354555657585960616263646566676869707172737475767778798081828384858687888990919293949596979899100101102103104105106107108109110111112113114115116117118119120121122123124125126127128129130131132
  1. <template>
  2. <view class="page">
  3. <view style="z-index: 10;" :class="isfan?'transform-180 transform-hidden transform-3d':'transform-0'"
  4. class="box"
  5. :style="'border-radius: '+ parseInt(long*0.1) +'px;' + 'clip:rect(0px,'+ long +'px,'+ parseInt(long*0.5) +'px,0px);'">
  6. <view class="hr hr-center" :style="'height: ' + parseInt(long*0.02) + 'px;'"></view>
  7. <view class="font-full num-center" :style="'font-size:'+ parseInt(long*0.5) +'px;'" v-text="old"></view>
  8. </view>
  9. <view style="z-index: 9;"
  10. :class="isfan?'transform-0 transform-3d transform-hidden':'transform-180 transform-hidden'" class="box"
  11. :style="'border-radius: '+ parseInt(long*0.1) +'px;' +'clip:rect('+ parseInt(long*0.5) +'px,'+ long +'px,'+ long +'px,0px);'">
  12. <view class="hr hr-center" :style="'height: ' + parseInt(long*0.02) + 'px;'"></view>
  13. <view class="font-full num-center" :style="'font-size:'+ parseInt(long*0.5) +'px;'" v-text="num"></view>
  14. </view>
  15. <view style="z-index: 2;" class="box"
  16. :style="'border-radius: '+ parseInt(long*0.1) +'px;' + (isfan?('clip:rect('+ parseInt(long*0.5) +'px,'+ long +'px,'+ long +'px,0px);'):'')">
  17. <view class="hr hr-center" :style="'height: ' + parseInt(long*0.02) + 'px;'"></view>
  18. <view class="font-full num-center" :style="'font-size:'+ parseInt(long*0.5) +'px;'" v-text="old"></view>
  19. </view>
  20. <view style="z-index: 1;" class="box"
  21. :style="'border-radius: '+ parseInt(long*0.1) +'px;' + (isfan?('clip:rect(0px,'+ long +'px,'+ parseInt(long*0.5) +'px,0px);'):'')">
  22. <view class="hr hr-center" :style="'height: ' + parseInt(long*0.02) + 'px;'"></view>
  23. <view class="font-full num-center" :style="'font-size:'+ parseInt(long*0.5) +'px;'" v-text="num"></view>
  24. </view>
  25. <block v-if="apm">
  26. <view class="apm" :style="'margin:'+parseInt(long*0.1)+'px;font-size:'+parseInt(long*0.1)+'px;'"
  27. v-text="apm"></view>
  28. </block>
  29. </view>
  30. </template>
  31. <script>
  32. export default {
  33. data() {
  34. return {
  35. old: 0,
  36. isfan: false
  37. }
  38. },
  39. props: {
  40. num: {
  41. default: ''
  42. },
  43. long: {
  44. default: 0
  45. },
  46. apm: {
  47. default: ''
  48. }
  49. },
  50. watch: {
  51. num() {
  52. this.isfan = true;
  53. setTimeout(() => {
  54. this.old = this.num;
  55. this.isfan = false;
  56. }, 600)
  57. }
  58. },
  59. created() {
  60. this.old = this.num;
  61. },
  62. methods: {}
  63. }
  64. </script>
  65. <style>
  66. .page {
  67. width: 100%;
  68. height: 100%;
  69. position: relative;
  70. }
  71. .box {
  72. position: absolute;
  73. width: 100%;
  74. height: 100%;
  75. background-image: linear-gradient(#161616, #111111);
  76. }
  77. .font-full {
  78. font-family: 'Franklin Gothic Medium', 'Arial Narrow', Arial, sans-serif;
  79. font-weight: bold;
  80. color: #bbb;
  81. /* background-color: #333; */
  82. }
  83. .num-center {
  84. text-align: center;
  85. line-height: 150%;
  86. height: 100%;
  87. }
  88. .hr-center {
  89. position: absolute;
  90. top: 50%;
  91. right: 0;
  92. left: 0;
  93. bottom: 0;
  94. }
  95. .hr {
  96. width: 100%;
  97. background-color: #000000;
  98. }
  99. .transform-180 {
  100. transform: rotateX(180deg);
  101. }
  102. .transform-3d {
  103. transition: 0.6s;
  104. transform-style: preserve-3d;
  105. }
  106. .transform-hidden {
  107. backface-visibility: hidden;
  108. }
  109. .transform-0 {
  110. transform: rotateX(0deg);
  111. }
  112. .apm {
  113. position: absolute;
  114. bottom: 0;
  115. color: #bbb;
  116. font-weight: bold;
  117. z-index: 11;
  118. }
  119. </style>