robin1liu / vue-mermaid

flowchart of mermaid with vue component
MIT License
126 stars 25 forks source link

Conditional links #11

Closed useo6 closed 4 years ago

useo6 commented 4 years ago

I need to create a link with different text to different nodes, e.g.:

mermaid-diagram-20191229114815

I tried using multiple links like this:

  nodes: [
    {
      id: "1",
      text: "A",
      link: ["-- yes -->", "-- no -->"],
      next: ["2", "3"],
      editable: true
    },
    { id: "2", text: "B", next: ["4"], editable: true },
    { id: "3", text: "C", next: ["4"], editable: true },
    { id: "4", text: "D"},
  ],

Unfortunately this creates something like this:

mermaid

Any idea?

robin1liu commented 4 years ago

same issue as #2

robin1liu commented 4 years ago

add support at version 0.0.12

foobst commented 4 years ago

I had the same issue and used the solution using a separate entry in the nodes array, but... it was only a work around. Now, I updated to version 0.0.12 to see if I can replace my workaround but I unfortunately 0.0.12 doesn't fix the problem... the problem still exists as described by useo6. I get the same result as with version 0.0.11:

grafik

Here's my package.json:

"dependencies": { "mermaid": "8.4.4", "vue-mermaid": "0.0.12" }

... and here are my nodes (copied from readme.md):

nodes = [
    {
      id: "1",
      text: "A",
      link: ["-- yes -->", "-- no -->"],
      next: ["2", "3"],
      editable: true
    },
    { id: "2", text: "B" },
    { id: "3", text: "C"}
  ]
}

I also restarted my vue dev server multiple times but nothing changed :-(

useo6 commented 4 years ago

@robin1liu The issue persists even in 0.0.12. I think you forgot to rebuild the dist-file because when I change the "main" property of the package.json of vue-mermaid to "main": "src/index.js" it works in 0.0.12. So, can you rebuild/update the dist-file?