lanniu / vue-mxgraph-example

Provide mxGraph sample programs under vue to help you get started quickly
https://demo.mxgraph.lanniu.top/
174 stars 53 forks source link

vue 中mxgraph 加载xml 不显示的问题 #21

Open zydwcp1113 opened 4 years ago

zydwcp1113 commented 4 years ago

var doc = mxUtils.parseXml(xml); var root = doc.documentElement; var dec = new mxCodec(root.ownerDocument); let decodeObj = dec.decode(root, this.graph.getModel()); this.graph.getModel().endUpdate(); 但是页面不显示,请教一下,不甚感激

zhangyu921 commented 4 years ago
      var xmlDocument = mxUtils.parseXml(mxlString2);
      if (
        xmlDocument.documentElement != null &&
        xmlDocument.documentElement.nodeName == "mxGraphModel"
      ) {
        var decoder = new mxCodec(xmlDocument);
        var node = xmlDocument.documentElement;

        decoder.decode(node, this.graph.getModel());
      }

也遇到了同样的问题,https://stackoverflow.com/a/50793107 这个答案说了放到全局,似乎也没有作用

dzm1314xxh commented 3 years ago

你用的方法mxCodec,mxUtils等都引进了没?