【发布时间】:2021-01-27 12:11:29
【问题描述】:
有没有一种方法可以动态设置论文的模型(也许,稍后,将其更改为另一层)?
或者是 JointJS / Rappid 仅限于(1 个模型:1 个论文)?
基本上,我希望能够在多个模型之间动态切换,并在一张纸上画出所有这些开关。
【问题讨论】:
标签: jointjs
有没有一种方法可以动态设置论文的模型(也许,稍后,将其更改为另一层)?
或者是 JointJS / Rappid 仅限于(1 个模型:1 个论文)?
基本上,我希望能够在多个模型之间动态切换,并在一张纸上画出所有这些开关。
【问题讨论】:
标签: jointjs
只需更改模型并重新渲染您的论文
const graph1 = new joint.dia.Graph();
const graph2 = new joint.dia.Graph();
const paper = new joint.dia.Paper({
el: document.getElementById('paper'),
height: '100%',
width: '100%'
});
function setPapaerModel(paper, model) {
paper.model = model; //set model
paper.render();
}
//Then you can change as you wish
setPaperModel(paper, graph2);
【讨论】: