Skip to content

Commit

Permalink
feat(tooltip)
Browse files Browse the repository at this point in the history
  • Loading branch information
martsimq committed Jul 19, 2024
1 parent e24cde1 commit 9b60b96
Show file tree
Hide file tree
Showing 3 changed files with 20 additions and 2 deletions.
16 changes: 16 additions & 0 deletions src/G6/plugins.ts
Original file line number Diff line number Diff line change
@@ -0,0 +1,16 @@
import G6 from "@antv/g6";
import { Task } from "@/type.ts";

export const tooltip = new G6.Tooltip({
offsetX: 10,
offsetY: 20,
getContent(e) {
const outDiv = document.createElement("div");
outDiv.style.width = "180px";
outDiv.innerHTML = `
<p>${(e?.item?.getModel().task as Task).name}</p>
`;
return outDiv;
},
itemTypes: ["node"],
});
4 changes: 2 additions & 2 deletions src/api/index.ts
Original file line number Diff line number Diff line change
Expand Up @@ -5,8 +5,8 @@
*/

// 手动修改 Mock 接口
// export * from "./job.ts";
export * from "./mock.ts";
export * from "./job.ts";
// export * from "./mock.ts";
export * from "./qgis.ts";

// TODO: interface definition of api
2 changes: 2 additions & 0 deletions src/components/BreakdownChart.vue
Original file line number Diff line number Diff line change
Expand Up @@ -6,6 +6,7 @@ import { IG6GraphEvent } from "@antv/g6-core/lib/types";
import { useGraphStore } from "@/store/graph.ts";
import { storeToRefs } from "pinia";
import { Task } from "@/type.ts";
import { tooltip } from "@/G6/plugins.ts";
const props = defineProps<{
graphId: string;
Expand Down Expand Up @@ -35,6 +36,7 @@ onMounted(() => {
"drag-canvas",
],
},
plugins: [tooltip],
defaultNode: {
type: "breakdownNode",
},
Expand Down

0 comments on commit 9b60b96

Please sign in to comment.