代码优化:提取render类前进回退方法公共逻辑
This commit is contained in:
parent
bce2bb8fc4
commit
0a36555343
@ -462,18 +462,18 @@ class Render {
|
|||||||
|
|
||||||
// 回退
|
// 回退
|
||||||
back(step) {
|
back(step) {
|
||||||
this.mindMap.execCommand('CLEAR_ACTIVE_NODE')
|
this.backForward('back', step)
|
||||||
let data = this.mindMap.command.back(step)
|
|
||||||
if (data) {
|
|
||||||
this.renderTree = data
|
|
||||||
this.mindMap.render()
|
|
||||||
}
|
|
||||||
}
|
}
|
||||||
|
|
||||||
// 前进
|
// 前进
|
||||||
forward(step) {
|
forward(step) {
|
||||||
|
this.backForward('forward', step)
|
||||||
|
}
|
||||||
|
|
||||||
|
// 前进回退
|
||||||
|
backForward(type, step) {
|
||||||
this.mindMap.execCommand('CLEAR_ACTIVE_NODE')
|
this.mindMap.execCommand('CLEAR_ACTIVE_NODE')
|
||||||
let data = this.mindMap.command.forward(step)
|
const data = this.mindMap.command[type](step)
|
||||||
if (data) {
|
if (data) {
|
||||||
this.renderTree = data
|
this.renderTree = data
|
||||||
this.mindMap.render()
|
this.mindMap.render()
|
||||||
|
|||||||
Loading…
x
Reference in New Issue
Block a user