vue-codemirror定位光标位置并在光标处插入信息 业务场景如下图:在代码编辑器外点击按钮,向代码编辑器内的光标处新增一条拼接好的信息。 //插入信息 copyValue(param) { let post1=this.$refs.myCode.codemirror.getCursor(); console.log('post1',post1); let pos2={ line:post1.line, //行号 ch:post1.ch //光标位置 } this.$refs.myCode.codemirror.replaceRange(param,pos2) //替换内容 }