Box.vue 1.4 KB

12345678910111213141516171819202122232425262728293031323334353637383940414243444546474849505152535455565758596061626364656667686970
  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. width: 136px;
  55. height: 100px;
  56. margin-right: 65px;
  57. overflow: hidden;
  58. border-radius: 3px;
  59. .swiper-slide{
  60. width: 100%;
  61. border-radius: 3px;
  62. }
  63. .swiper-container {
  64. height: 100%;
  65. }
  66. }
  67. </style>