This repository has been archived on 2025-09-14. You can view files and clone it, but cannot push or open issues or pull requests.
Files
cyber-narrator-cn-ui/src/views/charts/Panel.vue

39 lines
735 B
Vue
Raw Normal View History

2021-06-11 23:00:33 +08:00
<template>
<div>{{panel}}</div>
2021-06-11 23:00:33 +08:00
</template>
<script>
import { useRoute } from 'vue-router'
import { panelTypeAndRouteMapping } from '@/utils/constants'
2021-06-15 09:25:10 +08:00
import { api, getPanelList } from '@/utils/api'
2021-06-11 23:00:33 +08:00
export default {
name: 'Panel',
data () {
return {
panel: {}
}
},
async mounted () {
const panels = await getPanelList({ type: this.panelType })
if (panels && panels.length > 0) {
this.panel = panels[0]
}
2021-06-11 23:00:33 +08:00
},
setup () {
// 取得panel的type
let panelType = 1
const { params } = useRoute()
panelTypeAndRouteMapping[params.typeName] && (panelType = panelTypeAndRouteMapping[params.typeName])
return {
panelType,
api
}
}
}
</script>
<style>
</style>