h5-countdown.vue 1.6 KB

1234567891011121314151617181920212223242526272829303132333435363738394041424344454647484950515253545556575859606162636465666768697071727374757677
  1. <template>
  2. <div :class="config.classText.join(' ')">
  3. <div class="countdown2-box"
  4. :style="{ backgroundImage: config.bgImage && config.bgImage !== '#' ? `url(${config.bgImage})` : '' }"
  5. >
  6. 距结束<span id="days" :style="{background: config.mainColor}">{{ config.days }}</span>天
  7. <span id="hours" :style="{background: config.mainColor}">{{ config.hours }}</span>时
  8. <span id="minutes" :style="{background: config.mainColor}">{{ config.minutes }}</span>分
  9. <span id="seconds" :style="{background: config.mainColor}">{{ config.seconds }}</span>秒
  10. </div>
  11. </div>
  12. </template>
  13. <script>
  14. export default {
  15. name: 'h5-countdown',
  16. props: {
  17. config: {
  18. type: Object,
  19. default: () => {
  20. return {
  21. days: 'x',
  22. hours: 'x',
  23. minutes: 'x',
  24. seconds: 'x',
  25. classText: ['active'],
  26. bgImage: '#',
  27. mainColor:''
  28. }
  29. }
  30. }
  31. },
  32. watch:{
  33. 'config.bgImage':{
  34. handler(val){
  35. },
  36. deep:true
  37. }
  38. },
  39. created() {
  40. }
  41. }
  42. </script>
  43. <style src="./css/base.css"></style>
  44. <style lang="scss" scoped>
  45. p {
  46. white-space: pre-line;
  47. }
  48. .active {
  49. border-color: #02ff9b;
  50. }
  51. .countdown2-box {
  52. background: url('#') no-repeat center;
  53. background-size: 100%;
  54. width: 100%;
  55. height: 54px;
  56. line-height: 54px;
  57. color: #515A6E;
  58. font-size: 14px;
  59. text-align: center;
  60. }
  61. .countdown2-box span {
  62. display: inline-block;
  63. color: #fff;
  64. width: 22px;
  65. line-height: 20px;
  66. text-align: center;
  67. height: 20px;
  68. border-radius: 3px;
  69. margin: 7px;
  70. background: #FF5A29;
  71. }
  72. </style>