提交 f54a31e3 编写于 作者: yubinCloud's avatar yubinCloud

8-13 在文档页面点击文档节点时,获取并显示文档页面

上级 636717bf
......@@ -13,6 +13,7 @@
</a-tree>
</a-col>
<a-col :span="18">
<div :innerHTML="htmlContent"></div>
</a-col>
</a-row>
</a-layout-content>
......@@ -32,6 +33,8 @@ export default defineComponent({
setup() {
const route = useRoute();
const docs = ref();
const htmlContent = ref<string>();
htmlContent.value = "";
/**
* 一级文档树,children属性就是二级文档
......@@ -64,12 +67,38 @@ export default defineComponent({
});
};
/**
* 内容查询
**/
const handleQueryDocContent = (docId: string) => {
axios.get("/doc/read-content/" + docId).then((response) => {
const respData = response.data;
if (respData.code === 0) {
htmlContent.value = respData.data;
console.log(htmlContent);
} else {
message.error(respData.msg);
}
});
};
const onSelect = (selectedKeys: any, info: any) => {
console.log('selected', selectedKeys, info);
if (Tool.isNotEmpty(selectedKeys)) {
// 加载内容
handleQueryDocContent(selectedKeys[0]);
}
};
onMounted(() => {
handleQueryDoc();
});
return {
level1,
htmlContent,
onSelect,
}
}
});
......
Markdown is supported
0% .
You are about to add 0 people to the discussion. Proceed with caution.
先完成此消息的编辑!
想要评论请 注册