assign.vue
1.24 KB
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
<template>
<div class="">
<el-tabs v-model="activeTabs">
<el-tab-pane label="选择数据" name="1">
<select-info ref="selectInfoCom" v-if="activeTabs == 1" :id="id" :key="id"></select-info>
</el-tab-pane>
<el-tab-pane label="导入数据" name="2">
<import-vehicle ref="importVehicleCom" v-if="activeTabs == 2" :id="id" :key="id"></import-vehicle>
</el-tab-pane>
</el-tabs>
</div>
</template>
<script>
import SelectInfo from "./select.vue";
import ImportVehicle from "./import.vue";
export default {
name: "AssignInfo",
components: {
SelectInfo,
ImportVehicle,
},
props: {
id: {
type: [String, Number],
default: "",
},
},
data() {
return {
activeTabs: "1",
userId: "",
randomKey:''
};
},
watch:{
id:{
handler:function(){
console.log('key:',Math.random())
this.randomKey = Math.random()
}
}
},
mounted() {
this.userId = this.id;
},
methods: {
// 保存数据
saveInfo() {
if (this.activeTabs == 1) {
this.$refs.selectInfoCom.saveInfo();
return false;
}
this.$refs.importVehicleCom.saveInfo();
},
},
};
</script>
<style lang="scss" scoped>
</style>