antvis / g6-editor

532 stars 172 forks source link

自定义命令报错: 请设置有效的命令! #101

Open leeggco opened 5 years ago

leeggco commented 5 years ago

HTML

<i data-command="save" class="command el-icon el-icon-upload" title="保存"></i>

Javscript

Command.registerCommand('save', {
  // 命令是否进入队列,默认是 true
  queue: false,  
  // 命令是否可用
  enable(eidtor) {
    return true
  },
  // 正向命令
  execute(eidtor) {
    _this.saveGraph()
  },
  // 快捷键:Ctrl+shirt+s
  shortcutCodes : [['ctrlKey', 'shiftKey', 's']]
})

错误提示:

Wrong of Tip