From 468701b9ede783811e73b7b0fcbbf920fb314e27 Mon Sep 17 00:00:00 2001 From: zerlei <1445089819@qq.com> Date: Sat, 28 Sep 2024 00:14:20 +0800 Subject: [PATCH] =?UTF-8?q?feat:=20=E6=B7=BB=E5=8A=A0=E4=BA=86=E5=89=8D?= =?UTF-8?q?=E7=AB=AF=E5=B7=A5=E5=85=B7?= MIME-Version: 1.0 Content-Type: text/plain; charset=UTF-8 Content-Transfer-Encoding: 8bit --- Tool/webtool/index.html | 4 +- Tool/webtool/package.json | 2 + Tool/webtool/public/sync.svg | 1 + Tool/webtool/public/vite.svg | 1 - Tool/webtool/src/App.vue | 63 +++++++++++++--------- Tool/webtool/src/assets/sync.svg | 1 + Tool/webtool/src/assets/vue.svg | 1 - Tool/webtool/src/components/HelloWorld.vue | 40 -------------- Tool/webtool/src/main.js | 30 +++++++++-- 9 files changed, 70 insertions(+), 73 deletions(-) create mode 100644 Tool/webtool/public/sync.svg delete mode 100644 Tool/webtool/public/vite.svg create mode 100644 Tool/webtool/src/assets/sync.svg delete mode 100644 Tool/webtool/src/assets/vue.svg delete mode 100644 Tool/webtool/src/components/HelloWorld.vue diff --git a/Tool/webtool/index.html b/Tool/webtool/index.html index 8388c4b..cbcdcdc 100644 --- a/Tool/webtool/index.html +++ b/Tool/webtool/index.html @@ -2,9 +2,9 @@
- + -
- Edit
- components/HelloWorld.vue
to test HMR
-
- Check out - create-vue, the official Vue + Vite starter -
-- Install - Volar - in your IDE for a better DX -
-Click on the Vite and Vue logos to learn more
- - - diff --git a/Tool/webtool/src/main.js b/Tool/webtool/src/main.js index 2425c0f..1c58693 100644 --- a/Tool/webtool/src/main.js +++ b/Tool/webtool/src/main.js @@ -1,5 +1,27 @@ -import { createApp } from 'vue' -import './style.css' -import App from './App.vue' +import { createApp } from 'vue'; +import './style.css'; +import App from './App.vue'; +import editorWorker from 'monaco-editor/esm/vs/editor/editor.worker?worker'; +import jsonWorker from 'monaco-editor/esm/vs/language/json/json.worker?worker'; +import cssWorker from 'monaco-editor/esm/vs/language/css/css.worker?worker'; +import htmlWorker from 'monaco-editor/esm/vs/language/html/html.worker?worker'; +import tsWorker from 'monaco-editor/esm/vs/language/typescript/ts.worker?worker'; -createApp(App).mount('#app') +self.MonacoEnvironment = { + getWorker(_, label) { + if (label === 'json') { + return new jsonWorker(); + } + if (label === 'css' || label === 'scss' || label === 'less') { + return new cssWorker(); + } + if (label === 'html' || label === 'handlebars' || label === 'razor') { + return new htmlWorker(); + } + if (label === 'typescript' || label === 'javascript') { + return new tsWorker(); + } + return new editorWorker(); + }, +}; +createApp(App).mount('#app');