|
@@ -1,6 +1,6 @@
|
|
|
<script setup>
|
|
|
|
|
|
-import { getCurrentInstance, onMounted, watch, ref } from 'vue'
|
|
|
+import { getCurrentInstance, onMounted, watch, ref, computed } from 'vue'
|
|
|
import { useRoute, useRouter } from 'vue-router/composables'
|
|
|
import { TabPane, Tabs} from 'element-ui'
|
|
|
import { initPageModel } from '@/views/datapack/model/home'
|
|
@@ -9,6 +9,9 @@ const router = useRouter()
|
|
|
const route = useRoute()
|
|
|
|
|
|
const activeTab = ref('')
|
|
|
+const activeKey = computed(() => {
|
|
|
+ return activeTab.value + '_' + Date.now()
|
|
|
+})
|
|
|
const tabs = [
|
|
|
{ path: 'index', label: '我的数据流量包' },
|
|
|
{ path: 'history', label: '数据导出记录' }
|
|
@@ -23,6 +26,7 @@ function handleTabClick(tab) {
|
|
|
// 监听路由变化,更新激活标签
|
|
|
watch(route, (to) => {
|
|
|
activeTab.value = to.path.replace('/data_pack/', '')
|
|
|
+ initPageModel()
|
|
|
})
|
|
|
|
|
|
// 在组件挂载时初始化激活标签
|
|
@@ -44,7 +48,7 @@ onMounted(() => {
|
|
|
:label="tab.label"
|
|
|
:name="tab.path"
|
|
|
></el-tab-pane>
|
|
|
- <router-view></router-view>
|
|
|
+ <router-view :key='activeKey'></router-view>
|
|
|
</el-tabs>
|
|
|
</div>
|
|
|
</div>
|