uniapp,h5

tabbar-1.vue 1.4KB

12345678910111213141516171819202122232425262728293031323334353637383940414243444546474849505152535455565758596061626364
  1. <template>
  2. <view class="container">
  3. <uni-notice-bar show-icon scrollable color="#2979FF" background-color="#EAF2FF"
  4. text="🌸考研倒计时已经开始,每一天都充满了无限可能!所有的坚持都会换来结果,那些从困境中孕育出的花朵,必将绽放得绚烂。🎯设定目标,制定计划,然后全力以赴!考研的每一步都要走得坚定而有力。相信自己,你有足够的力量战胜一切困难,实现自己的梦想!" />
  5. <uni-card is-full padding>
  6. <text class="uni-h1">考研倒计时,距离考试还有</text>
  7. <uni-countdown ref="countdown" :font-size="30" :second="second" :show-colon="false"
  8. color="#FFFFFF" background-color="#67cfff" />
  9. </uni-card>
  10. </view>
  11. </template>
  12. <script>
  13. export default {
  14. components: {},
  15. data() {
  16. return {
  17. second: 0,
  18. targetTimestamp: 1797640200, // 目标日期
  19. }
  20. },
  21. mounted() {
  22. // 更新时间间隔
  23. this.updateTimeDifference();
  24. },
  25. methods: {
  26. updateTimeDifference() {
  27. const now = Math.trunc(Date.now() / 1000); // 当前时间的时间戳
  28. this.second = this.targetTimestamp - now;
  29. // console.log(this.second);
  30. }
  31. }
  32. }
  33. </script>
  34. <style>
  35. .container {
  36. padding: 20upx;
  37. }
  38. .header {
  39. text-align: center;
  40. margin-bottom: 20upx;
  41. }
  42. .title {
  43. font-size: 32upx;
  44. font-weight: bold;
  45. color: #333;
  46. }
  47. .content {
  48. text-align: center;
  49. }
  50. .description {
  51. font-size: 24upx;
  52. color: #666;
  53. }
  54. </style>