CN-697 feat: npm-tab保留状态

This commit is contained in:
chenjinsong
2022-09-07 21:32:43 +08:00
parent c9f34523e0
commit 66d5e134a8
2 changed files with 45 additions and 18 deletions

View File

@@ -38,6 +38,8 @@ import _ from 'lodash'
import Chart from '@/views/charts2/Chart'
import { panelTypeAndRouteMapping, storageKey, drillDownPanelTypeMapping } from '@/utils/constants'
import { typeMapping } from '@/views/charts2/chart-tools'
import { useRoute } from 'vue-router'
import { ref } from 'vue'
export default {
name: 'ChartList',
props: {
@@ -52,8 +54,7 @@ export default {
return {
panelTypeAndRouteMapping,
typeMapping,
layout: [],
npmTabIndex: 0
layout: []
}
},
components: {
@@ -61,6 +62,14 @@ export default {
GridItem: VueGridLayout.GridItem,
Chart
},
setup () {
const { query } = useRoute()
const tabIndexParam = query.tabIndex
const npmTabIndex = ref(tabIndexParam ? parseInt(tabIndexParam) : 0)
return {
npmTabIndex
}
},
watch: {
chartList (n) {
if (!_.isEmpty(n)) {