小编tes*_*r12的帖子

如何将 Monaco 与 Vue.js 集成?

我创建了一个新的 vue 应用程序并运行npm install -s monaco-editor,然后我将 App.vue 更改为如下所示:

<template>
    <div id="app" style="width: 500px; height: 500px;">
        <div ref="editor" style="width: 500px; height: 500px;"></div>
  </div>
</template>

<script>
import * as monaco from 'monaco-editor';

export default {
  name: 'app',
  async mounted() {
    const el = this.$refs.editor;
    this.editor = monaco.editor.create(el, {
      value: "console.log('hello world');",
      language: 'javascript',
    });
  },
};
</script>
Run Code Online (Sandbox Code Playgroud)

当我运行应用程序时,我在 JavaScript 控制台中看到以下内容:

Could not create web worker(s). Falling back to loading web worker code in main thread, which might cause UI freezes. …
Run Code Online (Sandbox Code Playgroud)

javascript vue.js

11
推荐指数
2
解决办法
4554
查看次数

标签 统计

javascript ×1

vue.js ×1