当前位置: 首页 > news >正文

web在线编辑器(vue版)

目录

  • 前言
  • 一、monaco-editor
    • 1、源码
    • 2、体积优化
  • 二、ace-editor?
    • 1、源码
    • 2、体积优化
  • 总结


前言

提示:这里可以添加本文要记录的大概内容:

例如:随着人工智能的不断发展,机器学习这门技术也越来越重要,很多人都开启了学习机器学习,本文就介绍了机器学习的基础内容。


提示:以下是本篇文章正文内容,下面案例可供参考

一、monaco-editor

1、源码

<template><div ref="monacoEditor" id="monacoEditor" :style="style"></div>
</template><script setup>
import { nextTick, onMounted, ref, watch, onBeforeUnmount } from "vue";
import * as monaco from "monaco-editor";
const props = defineProps({modelValue: {},style: {},readOnly: {},language: {},content: {},
});const emit = defineEmits(["update:modelValue"]);const monacoEditor = ref();
let editor;const init = () => {/*** @param wordWrap 自动换行,注意大小写*/editor = monaco.editor.create(monacoEditor.value, {automaticLayout: true,value: props.modelValue,readOnly: props.readOnly,theme: "vs-dark",language: props.language,wordWrap: "on",wrappingIndent: "indent",});// 监听值的变化editor.onDidChangeModelContent(() => {emit("update:modelValue", editor.getValue());});
};
onMounted(() => {init();
});watch(() => props.language,(nv, ov) => {monaco.editor.setModelLanguage(editor.getModel(), nv);}
);function updateValue() {setTimeout(() => {editor.setValue(props.modelValue);}, 200);
}watch(() => props.language,(newValue) => {monaco.editor.setModelLanguage(editor.getModel(), newValue);}
);
defineExpose({ updateValue });
</script><style></style>
<config-editv-model="tempFlow.textareashow":language="tempFlow.language":readOnly="false"style="height: 100%; width: 100%"
></config-edit>

2、体积优化

待续…

二、ace-editor?

1、源码

代码如下(示例):

<template><v-ace-editorv-model:value="modelValue"@init="init"lang="json":theme="theme":options="options":readonly="readonly":style="style"/>
</template><script setup>
import { VAceEditor } from "vue3-ace-editor";
import "ace-builds/webpack-resolver";
import "ace-builds/src-noconflict/mode-json";
import "ace-builds/src-noconflict/theme-chrome";
import "ace-builds/src-noconflict/ext-language_tools";const props = defineProps({modelValue: {},theme: {},options: {},readonly: {},//自定义行内样式style: {},
})</script><style></style>
<ace-editorv-model:value="tempFlow.textareashow"@init="initFail"lang="json":theme="aceConfig.theme":options="aceConfig.options":readonly="aceConfig.readOnly"class="ace-editor"
/>

2、体积优化

待续…


总结

提示:这里对文章进行总结:

记录web在线编辑器的

http://www.lryc.cn/news/128714.html

相关文章:

  • 【论文阅读】 Model Sparsity Can Simplify Machine Unlearning
  • Spring Clould 部署 - Docker
  • linux--链表动态创建
  • iBooker 布客技术评论 20230818
  • CK-A60180、CK-B1542、CK-L3095单向离合器
  • 单因素多变量方差分析
  • Python Web:Django、Flask和FastAPI框架对比
  • 【CI/CD】Rancher K8s
  • nodejs 之 express 实现下载网络图片并上传到七牛云对象存储oss空间
  • 综合能源系统(7)——综合能源综合评估技术
  • 【JS 线性代数算法之向量与矩阵】
  • 配置 yum/dnf 置您的系统以使用默认存储库
  • Docker容器与虚拟化技术:Docker资源控制、数据管理
  • python生成器有几种写法,python生成器函数例子
  • 动态动画弹窗样式css
  • 数据生成 | MATLAB实现WGAN生成对抗网络数据生成
  • PHP实现每日蛋白质摄入量计算器
  • vue elment 表格内表单校验代码
  • 如何在Stream流中分组统计
  • windows程序基础
  • 【LeetCode】买卖股票的最佳时机最多两次购买机会
  • 【C++ 记忆站】命名空间
  • 《离散数学及其应用(原书第8版)》ISBN978-7-111-63687-8 第11章 11.1.3 树的性质 节 第664页的例9说明
  • 【云原生】K8S存储卷:PV、PVC详解
  • 谈谈IP地址和子网掩码的概念及应用
  • vue2 如何监听数组的变化
  • CSS中的transform属性有哪些值?并分别描述它们的作用。
  • vue3跳转页面后 海康监控实例不销毁
  • Unity 射线检测
  • 微信支付报非法的密钥大小: Caused by: java.security.InvalidKeyException: Illegal key size