2021-10-17 19:50:22 +08:00
|
|
|
<template>
|
2021-10-26 22:32:42 +08:00
|
|
|
<a-tabs v-model:activeKey="activePage" closable @tab-click="changePage" style="padding: 5px 10px 0;">
|
2021-10-26 23:49:47 +08:00
|
|
|
<a-tab-pane tab="接口说明" key="doc">
|
|
|
|
|
{{activePage}}
|
|
|
|
|
</a-tab-pane>
|
|
|
|
|
<a-tab-pane tab="在线调试" key="debug">
|
|
|
|
|
{{activePage}}
|
|
|
|
|
</a-tab-pane>
|
2021-10-26 22:32:42 +08:00
|
|
|
</a-tabs>
|
2021-10-17 19:50:22 +08:00
|
|
|
</template>
|
|
|
|
|
|
|
|
|
|
<script>
|
2021-10-26 23:49:47 +08:00
|
|
|
import {toRefs, ref, reactive, onMounted, onActivated} from 'vue';
|
|
|
|
|
import { useRouter, useRoute } from "vue-router";
|
2021-10-26 22:32:42 +08:00
|
|
|
import {useStore} from 'vuex';
|
|
|
|
|
import { message } from 'ant-design-vue';
|
|
|
|
|
import { onBeforeRouteLeave, onBeforeRouteUpdate } from 'vue-router'
|
2021-10-17 19:50:22 +08:00
|
|
|
|
2021-10-26 22:32:42 +08:00
|
|
|
export default {
|
|
|
|
|
setup() {
|
2021-10-26 23:49:47 +08:00
|
|
|
const route = useRoute();
|
|
|
|
|
const store = useStore();
|
2021-10-26 22:32:42 +08:00
|
|
|
let activePage = ref('doc');
|
2021-10-26 23:49:47 +08:00
|
|
|
onMounted(() => {
|
|
|
|
|
console.log('DocView onMounted', route.query);
|
|
|
|
|
let path = route.query.path + '.' + route.query.method;
|
2021-10-26 22:32:42 +08:00
|
|
|
let docInfo = store.state.swaggerTreePathMap[path];
|
|
|
|
|
if (!docInfo) {
|
|
|
|
|
message.error('没有找到对应的文档');
|
|
|
|
|
return;
|
|
|
|
|
}
|
2021-10-26 23:49:47 +08:00
|
|
|
store.commit('addTableName', {key: route.fullPath, val: docInfo.summary});
|
2021-10-26 22:32:42 +08:00
|
|
|
});
|
|
|
|
|
const changePage = () => {
|
|
|
|
|
|
|
|
|
|
}
|
|
|
|
|
return {
|
|
|
|
|
activePage,
|
|
|
|
|
changePage,
|
|
|
|
|
};
|
|
|
|
|
},
|
|
|
|
|
};
|
2021-10-17 19:50:22 +08:00
|
|
|
</script>
|
2021-10-26 22:32:42 +08:00
|
|
|
|