Box.vue 1.5 KB

12345678910111213141516171819202122232425262728293031323334353637383940414243444546474849505152535455565758596061626364656667686970717273
  1. <template>
  2. <div class="count-box">
  3. <div class="swiper-container" v-swiper:swiper="swiperOption">
  4. <div class="swiper-wrapper">
  5. <div class="swiper-slide" v-for="(c, index) in counts.data" :key="index">
  6. <count-item class="item" :title="c.item" :value="c.count"></count-item>
  7. </div>
  8. </div>
  9. </div>
  10. </div>
  11. </template>
  12. <script>
  13. import CountItem from './Item.vue'
  14. export default {
  15. name: 'count-box',
  16. components: {
  17. CountItem
  18. },
  19. data () {
  20. return {
  21. swiperOption: {
  22. autoplay: 5000,
  23. speed: 500,
  24. direction: 'vertical',
  25. slidesPerView: 1,
  26. slidesPerGroup: 1
  27. }
  28. }
  29. },
  30. computed: {
  31. counts () {
  32. return this.$store.state.product.common.counts
  33. }
  34. },
  35. // mounted () {
  36. // this.$nextTick(() => {
  37. // // 刷新统计信息
  38. // setInterval(() => {
  39. // this.loadCounts()
  40. // }, 30000)
  41. // })
  42. // },
  43. methods: {
  44. loadCounts () {
  45. this.$store.dispatch('loadProductCounts', { _status: 'actived' })
  46. }
  47. }
  48. }
  49. </script>
  50. <style lang="scss" scoped>
  51. .count-box {
  52. position: relative;
  53. top: 20px;
  54. float: right;
  55. width: 210px;
  56. height: 40px;
  57. margin-right: 65px;
  58. overflow: hidden;
  59. border-radius: 3px;
  60. background: url("/images/all/count_bg.png") no-repeat;
  61. /*background: #7299E8;*/
  62. .swiper-slide{
  63. width: 100%;
  64. /*background: #83c5f8;*/
  65. border-radius: 3px;
  66. }
  67. .swiper-container {
  68. height: 100%;
  69. }
  70. }
  71. </style>