Skip to content
New issue

Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.

By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.

Already on GitHub? Sign in to your account

请问能不能修改更新数据? #38

Open
LiangQinAo opened this issue Aug 6, 2020 · 13 comments
Open

请问能不能修改更新数据? #38

LiangQinAo opened this issue Aug 6, 2020 · 13 comments

Comments

@LiangQinAo
Copy link

LiangQinAo commented Aug 6, 2020

我直接let json = this.$refs['wfd'].graph.save()获取数据
直接赋值 this.demoData = json
发现这样并不能正常更新数据?是什么原因?

@LiangQinAo LiangQinAo changed the title 请问有没有各个节点的点击事件? 请问能不能修改更新数据? Aug 6, 2020
@qinzitong
Copy link

我直接let json = this.$refs['wfd'].graph.save()获取数据
直接赋值 this.demoData = json
发现这样并不能正常更新数据?是什么原因?

跟监听数据有关系,
data(oldData,newData){
if(oldData !== newData) {
if (this.graph) {
this.graph.changeData(this.initShape(newData));
this.graph.setMode(this.mode);
this.graph.emit('canvas:click');
if (this.cmdPlugin) {
this.cmdPlugin.initPlugin(this.graph);
}
if (this.isView) {
this.graph.fitView(5)
}
}
}
},
并不能觉察到你的数据发生了变化

@LiangQinAo
Copy link
Author

我直接let json = this.$refs['wfd'].graph.save()获取数据
直接赋值 this.demoData = json
发现这样并不能正常更新数据?是什么原因?

跟监听数据有关系,
data(oldData,newData){
if(oldData !== newData) {
if (this.graph) {
this.graph.changeData(this.initShape(newData));
this.graph.setMode(this.mode);
this.graph.emit('canvas:click');
if (this.cmdPlugin) {
this.cmdPlugin.initPlugin(this.graph);
}
if (this.isView) {
this.graph.fitView(5)
}
}
}
},
并不能觉察到你的数据发生了变化

感谢回复,我测试了一下 直接赋值的确不能监听到,反而我点击了一下" 查看流程 " 按钮,再赋值,监听到了,但是发生了报错。
Snipaste_2020-08-07_10-12-10

我想知道为什么默认的数据不能为空?如果默认数据是空的话会报错,并且完全瘫痪

@GoldSubmarine
Copy link
Contributor

@Liang-aj 你可以试试 workflow-bpmn-modeler

@LiangQinAo
Copy link
Author

@Liang-aj 你可以试试 workflow-bpmn-modeler

谢谢回复,客户硬性要求这个的样式,没办法换其他方案

@guozhaolong
Copy link
Owner

我不太确定这个啥原因啊,vue我不太熟,react的话需要之行setState才能让页面感知到你的数据变化

@LiangQinAo
Copy link
Author

我不太确定这个啥原因啊,vue我不太熟,react的话需要之行setState才能让页面感知到你的数据变化

请问为什么原来的数据是空的话,会报错呢?

@GoldSubmarine
Copy link
Contributor

hack 一下,如果没有数据的时候,用 v-if 把组件标签隐藏了,获取到数据以后,再显示出来,保证组件渲染的时候 data 已经有数据了

@LiangQinAo
Copy link
Author

hack 一下,如果没有数据的时候,用 v-if 把组件标签隐藏了,获取到数据以后,再显示出来,保证组件渲染的时候 data 已经有数据了

好的,我试试,我想知道关于那个XML该怎么使用?

@qinzitong
Copy link

我直接let json = this.$refs['wfd'].graph.save()获取数据
直接赋值 this.demoData = json
发现这样并不能正常更新数据?是什么原因?

跟监听数据有关系,
data(oldData,newData){
if(oldData !== newData) {
if (this.graph) {
this.graph.changeData(this.initShape(newData));
this.graph.setMode(this.mode);
this.graph.emit('canvas:click');
if (this.cmdPlugin) {
this.cmdPlugin.initPlugin(this.graph);
}
if (this.isView) {
this.graph.fitView(5)
}
}
}
},
并不能觉察到你的数据发生了变化

感谢回复,我测试了一下 直接赋值的确不能监听到,反而我点击了一下" 查看流程 " 按钮,再赋值,监听到了,但是发生了报错。
Snipaste_2020-08-07_10-12-10

我想知道为什么默认的数据不能为空?如果默认数据是空的话会报错,并且完全瘫痪

this.graph.changeData(data)
this.graph.changeSize()
这两个方法可以使 图表跟着数据刷新

@LiangQinAo
Copy link
Author

我直接let json = this.$refs['wfd'].graph.save()获取数据
直接赋值 this.demoData = json
发现这样并不能正常更新数据?是什么原因?

跟监听数据有关系,
data(oldData,newData){
if(oldData !== newData) {
if (this.graph) {
this.graph.changeData(this.initShape(newData));
this.graph.setMode(this.mode);
this.graph.emit('canvas:click');
if (this.cmdPlugin) {
this.cmdPlugin.initPlugin(this.graph);
}
if (this.isView) {
this.graph.fitView(5)
}
}
}
},
并不能觉察到你的数据发生了变化

感谢回复,我测试了一下 直接赋值的确不能监听到,反而我点击了一下" 查看流程 " 按钮,再赋值,监听到了,但是发生了报错。
Snipaste_2020-08-07_10-12-10
我想知道为什么默认的数据不能为空?如果默认数据是空的话会报错,并且完全瘫痪

this.graph.changeData(data)
this.graph.changeSize()
这两个方法可以使 图表跟着数据刷新

谢谢!

@buzzlu
Copy link

buzzlu commented Dec 22, 2020

我赋值后,调用this.graph.changeData(data) ,还是无效。

2020-12-22 16_11_50-Edit vue - vuejs  SSH_ sandbox  - Visual Studio Code  Administrator

@zongyan86
Copy link

this.graph.changeData(data)果然是无效

@sofm13
Copy link

sofm13 commented Jul 16, 2021

image
newData,oldData需要反过来一下

Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment
Labels
None yet
Projects
None yet
Development

No branches or pull requests

7 participants