zzzz
2024-03-26 0df61bbe45cd6adf9de18074b5e978673247be85
1
2
3
4
5
6
7
8
9
10
11
12
13
14
15
16
17
18
19
20
21
22
23
24
25
26
27
28
29
30
31
32
33
34
35
36
37
38
39
40
41
42
43
44
45
46
47
48
49
50
51
52
53
54
55
56
57
58
59
60
61
62
63
64
65
66
67
68
69
70
71
72
73
74
75
76
77
78
79
80
81
82
83
84
85
86
87
88
89
90
91
92
93
94
95
96
97
98
99
100
101
102
103
104
105
106
107
108
109
110
111
112
113
114
<template>
  <div class="ware">
    <div style="padding: 0 0.4rem 0.4rem">
      <div class="tabs-box" onscroll="handleScroll">
        <div
          v-for="(item, index) in tabsArr"
          :key="index"
          :class="
            item.name == active ? 'tabs-item-active tabs-item' : 'tabs-item'
          "
          @click="onClick(item)"
        >
          {{ item.title }}
        </div>
      </div>
 
      <template v-if="active === '1'">
        <div v-for="(item, index) in tabsArr" :key="index">
          <card :item="item" />
        </div>
      </template>
      <template v-else>
        <itemCard :activeObj="activeObj" />
      </template>
    </div>
    <dataList />
  </div>
</template>
 
<script>
import card from "./Warehouse/card.vue";
import itemCard from "./Warehouse/item.card.vue";
import dataList from "./Warehouse/data.list.vue";
 
export default {
  components: { card, itemCard, dataList },
  data() {
    return {
      actives: "1",
      active: "1",
      activeObj: {},
      tabsArr: [
        {
          title: "总资产",
          name: "1",
          bgc: "rgb(8, 82, 196)",
          laber: "USD",
        },
        {
          title: this.$t("mggs"),
          name: "2",
          bgc: "rgb(12, 175, 226)",
          laber: "USD",
        },
        {
          title: this.$t("ydgs"),
          name: "3",
          bgc: "rgb(255, 91, 150)",
          laber: "THB",
        },
      ],
    };
  },
  methods: {
    onClick(e) {
      console.log(e);
      this.active = e.name;
      this.activeObj = e;
      // console.log(e);
    },
  },
};
</script>
 
<style lang="less" scoped>
.ware {
  overflow: hidden;
  min-height: 100vh;
  // padding: 0 0.4rem 0.4rem;
  background-color: #fff;
  padding-bottom: 100px;
}
.tabs-box {
  display: flex;
  overflow-x: auto;
  width: 100%; /* Ensures it takes full width of the container */
  white-space: nowrap; /* Prevents text wrapping */
  background: rgb(247, 247, 250);
  margin-top: 20px;
  border-radius: 20px;
  padding-right: 20px;
}
.tabs-box::-webkit-scrollbar {
  display: none; /* Chrome, Safari, Opera */
}
.tabs-item {
  cursor: pointer;
  flex: 0 0 auto; /* Ensures items do not grow or shrink */
  padding: 15px; /* Adjust padding as needed */
  // border: 1px solid #ccc; /* Just for demonstration, you can style as needed */
  margin-right: 10px; /* Adjust margin as needed */
  min-width: 100px; /* Minimum width for each item */
  text-align: center;
  color: rgb(140, 159, 173);
  font-size: 16px;
  // padding: 0.10667rem 0.34667rem;
}
.tabs-item-active {
  border-radius: 20px;
  background: #39a08e;
  // padding: 0.10667rem 0.34667rem;
  color: #fff;
}
</style>