为什么'CodeMirror.hint.anyword'在react-codemirror中不起作用

时间:2018-08-16 10:05:19

标签: javascript html reactjs codemirror

editor.on(“ keydown”,function(cm,event){       // console.log(CodeMirror)       如果(         !(event.ctrlKey)&&         (event.keyCode> = 65 && event.keyCode <= 90)||         (event.keyCode> = 97 && event.keyCode <= 122)||         (event.keyCode> = 46 && event.keyCode <= 57)       ){           cm.showHint({提示:CodeMirror.hint.anyword,completeSingle:false});       }     }); enter image description here

1 个答案:

答案 0 :(得分:0)

editor.on("keydown", function (cm, event) {
  // console.log(CodeMirror)
  if (
    !(event.ctrlKey) &&
    (event.keyCode >= 65 && event.keyCode <= 90) || 
    (event.keyCode >= 97 && event.keyCode <= 122) || 
    (event.keyCode >= 46 && event.keyCode <= 57)
  ) {
      cm.showHint({hint: CodeMirror.hint.anyword,completeSingle: false});
  }
});

enter image description here