mirror of
https://gitee.com/durcframework/SOP.git
synced 2025-08-11 21:57:56 +08:00
5.0
This commit is contained in:
@@ -11,6 +11,8 @@ export const apiModules = ref([]);
|
||||
export const dataNodeType = ref("Object");
|
||||
export const requestParamsExample = ref({});
|
||||
export const responseParamsExample = ref({});
|
||||
export const defaultExpandedKeys = ref([]);
|
||||
export const currentNodeKey = ref(0);
|
||||
|
||||
export const docAppId = ref(0);
|
||||
export const docAppList = ref([]);
|
||||
@@ -234,6 +236,16 @@ function loadDocTree(id) {
|
||||
};
|
||||
docApi.listDocTree(params).then(resp => {
|
||||
docTree.value = resp.data;
|
||||
// 默认展开并选中第一个
|
||||
if (docTree.value?.length > 0) {
|
||||
defaultExpandedKeys.value.push(docTree.value[0].docId);
|
||||
const children = docTree.value[0]?.children;
|
||||
if (children && children.length > 0) {
|
||||
const firstNode = children[0];
|
||||
currentNodeKey.value = firstNode.docId;
|
||||
handleNodeClick(firstNode);
|
||||
}
|
||||
}
|
||||
});
|
||||
}
|
||||
|
||||
|
@@ -15,7 +15,9 @@ import {
|
||||
showUrl,
|
||||
showProdUrl,
|
||||
showSandBoxUrl,
|
||||
showDoc
|
||||
showDoc,
|
||||
defaultExpandedKeys,
|
||||
currentNodeKey
|
||||
} from "./index";
|
||||
import { ApiParamTable } from "@/components/ApiParamTable";
|
||||
import { useRouter } from "vue-router";
|
||||
@@ -45,6 +47,9 @@ const defaultProps = {
|
||||
<el-tree
|
||||
:data="docTree"
|
||||
:props="defaultProps"
|
||||
node-key="docId"
|
||||
:default-expanded-keys="defaultExpandedKeys"
|
||||
:current-node-key="currentNodeKey"
|
||||
style="margin-top: 10px"
|
||||
highlight-current
|
||||
@node-click="handleNodeClick"
|
||||
|
Reference in New Issue
Block a user