feat: panel初始化,api提取

This commit is contained in:
chenjinsong
2021-06-11 23:00:33 +08:00
parent ffc7652fc5
commit f2dafb19cb
7 changed files with 80 additions and 28 deletions

View File

@@ -0,0 +1,35 @@
<template>
<div>{{panel.name}}</div>
</template>
<script>
import { useRoute } from 'vue-router'
import { panelTypeAndRouteMapping } from '@/utils/constants'
import { panel as api, getPanelList } from '@/utils/api'
export default {
name: 'Panel',
data () {
return {
panel: {}
}
},
async mounted () {
this.panel = (await getPanelList({ type: this.panelType }))[0]
},
setup () {
// 取得panel的type
let panelType = 1
const { params } = useRoute()
panelTypeAndRouteMapping[params.typeName] && (panelType = panelTypeAndRouteMapping[params.typeName])
return {
panelType,
api
}
}
}
</script>
<style>
</style>