赞
踩
使用monacoEditor.value.getValue()函数后页面卡顿,无法获取编辑器的值
- monacoEditor.value.onDidChangeModelContent(() => {
- // 触发父组件的 change 事件,通知编辑器内容变化
- jsonContent.value = monacoEditor.value.getValue();
- });
解决方法:
- import { toRaw } from "vue"
- const getVal = () => {
- return toRaw(monacoEditor.value).getValue(); //获取编辑器中的文本
- };
Copyright © 2003-2013 www.wpsshop.cn 版权所有,并保留所有权利。