gaoluyang
18 小时以前 19aa78a505d468739a61054f07d0840477192b2d
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
<!-- 在你的主页面中 -->
<template>
  <div class="app-container">
    <el-tabs v-model="activeTab" @tab-change="handleTabChange">
      <el-tab-pane v-for="tab in tabs"
                   :label="tab.label"
                   :name="tab.name"
                   :key="tab.name">
        <record :type="tab.type" v-if="activeTab === tab.name" />
      </el-tab-pane>
    </el-tabs>
  </div>
</template>
 
<script setup>
import Record from "@/views/inventoryManagement/dispatchLog/Record.vue";
import { computed, ref } from "vue";
 
const activeTab = ref('selfMade')
const type = ref(1)
const tabs = computed(() => {
  return [
    {
      label: '自制',
      name: 'selfMade',
      type: 1
    },
    {
      label: '外购',
      name: 'purchase',
      type: 2
    },
    {
      label: '委外',
      name: 'outsourcing',
      type: 3
    }
  ]
})
 
const handleTabChange = (tabName) => {
  activeTab.value = tabName;
  const tab = tabs.value.find(t => t.name === tabName);
  type.value = tab ? tab.type : 1;
}
</script>