Skip to content

Commit b57d53f

Browse files
committed
feat(doc): 知识网络图当前节点使用实际颜色
- 获取当前节点的实际颜色值作为高亮显示的颜色 - 将当前节点的高亮颜色从固定的 #F56C 改为动态获取的节点实际颜色 - 同时更新图例中当前节点的显示颜色以保持一致
1 parent 62154a2 commit b57d53f

1 file changed

Lines changed: 6 additions & 2 deletions

File tree

src/pages/doc/knowledge/KnowledgeNetworkChart.vue

Lines changed: 6 additions & 2 deletions
Original file line numberDiff line numberDiff line change
@@ -224,11 +224,15 @@ export default defineComponent({
224224
});
225225
226226
// 定义特殊类别(当前节点和上下游节点)
227+
// 取当前节点的实际颜色
228+
const currentNodeData = nodes.find((n: any) => n.name === this.doc);
229+
const currentNodeColor = currentNodeData?.itemStyle?.color || '#000000';
230+
227231
const specialCategories = [
228232
{
229233
name: "当前",
230234
itemStyle: {
231-
color: "#F56C6C",
235+
color: currentNodeColor,
232236
opacity: this.isDark ? 0.9 : 1
233237
},
234238
},
@@ -239,7 +243,7 @@ export default defineComponent({
239243
const legendData = [
240244
{ name: "当前", icon: "roundRect",
241245
itemStyle: {
242-
color: "#F56C6C",
246+
color: currentNodeColor,
243247
opacity: this.isDark ? 0.9 : 1
244248
},
245249
textStyle: { color: this.isDark ? '#eee' : '#555' }},

0 commit comments

Comments
 (0)