robin1liu / vue-mermaid

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

Invalid link representation #13

Open dmitry-worker opened 4 years ago

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

Expected: https://raw.githubusercontent.com/robin1liu/vue-mermaid/HEAD/img/links.jpg Actual:

graph LR
1[A]-- yes -->,-- no -->2[B]
1[A]-- yes -->,-- no -->3[C]
2[B]
3[C]
TE-ShinyaYamada commented 4 years ago

I found a workaround. When defining a separate node, it can be realized.

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

But then why would the link attribute be an array if it can only have an length of 1? That doesn't make much sense to allude to multiple links via that attribute's data type but then not be able to render it as expected

TE-ShinyaYamada commented 4 years ago

Of course It is definitely a bug since readme.md shows a node with multiple links are allowed. https://github.com/robin1liu/vue-mermaid#different-link-values-of-next

So, my solution is just a workaround.

alberto-bottarini commented 4 years ago

Any news about this bug?

TE-ShinyaYamada commented 4 years ago

I found a comment https://github.com/robin1liu/vue-mermaid/issues/11#issuecomment-569527049 mentioning that modifying vue-mermaid/package.json manually will resolve the bug.

alberto-bottarini commented 4 years ago

Thanks, but i will prefer your workaround