当前位置:   article > 正文

vue3 引入monaco editor之后页面卡顿_ondidchangemodelcontent

ondidchangemodelcontent

使用monacoEditor.value.getValue()函数后页面卡顿,无法获取编辑器的值

  1. monacoEditor.value.onDidChangeModelContent(() => {
  2. // 触发父组件的 change 事件,通知编辑器内容变化
  3. jsonContent.value = monacoEditor.value.getValue();
  4. });

解决方法:

  1. import { toRaw } from "vue"
  2. const getVal = () => {
  3. return toRaw(monacoEditor.value).getValue(); //获取编辑器中的文本
  4. };

声明:本文内容由网友自发贡献,转载请注明出处:【wpsshop博客】
推荐阅读
相关标签
  

闽ICP备14008679号