File tree Expand file tree Collapse file tree 3 files changed +14
-0
lines changed Expand file tree Collapse file tree 3 files changed +14
-0
lines changed Original file line number Diff line number Diff line change 4545 < button onClick ="focusOn() "> 定位到五角星</ button >
4646 < button id ="undo " onClick ="undo() " disabled > 上一步</ button >
4747 < button id ="redo " onClick ="redo() " disabled > 下一步</ button >
48+ < button id ="clearData " onClick ="clearData() "> 清空数据</ button >
4849 </ div >
4950 < div id ="app "> </ div >
5051 < div id ="debug "> </ div >
103104 window . redo = function redo ( ) {
104105 lf . redo ( )
105106 }
107+ window . clearData = function clearData ( ) {
108+ lf . clearData ( )
109+ }
106110 window . consolelog = function consolelog ( msg ) {
107111 console . log ( msg )
108112 }
Original file line number Diff line number Diff line change @@ -635,6 +635,10 @@ export default class LogicFlow {
635635 this . snaplineModel . clearSnapline ( ) ;
636636 }
637637 }
638+ // 清空数据
639+ clearData ( ) {
640+ this . graphModel . clearData ( ) ;
641+ }
638642 /**
639643 * 获取边的model
640644 * @param edgeId 边的Id
Original file line number Diff line number Diff line change @@ -599,6 +599,12 @@ class GraphModel {
599599 @action setTheme ( style : Style ) {
600600 this . theme = updateTheme ( { ...this . theme , ...style } ) ;
601601 }
602+ // 清空数据
603+ @action
604+ clearData ( ) : void {
605+ this . nodes = [ ] ;
606+ this . edges = [ ] ;
607+ }
602608}
603609
604610export { GraphModel } ;
You can’t perform that action at this time.
0 commit comments