Closed Thy3634 closed 2 years ago
I released the new version and this error should be fixed successfully.
Now editorRef.value.$editor
is a instance of the editor (ref
ref
is automatically unwrapped by Vue). The document will also be fixed soon.
@1.0.4 / @1.0.3
Not fixed😕
And got this: [Vue Router warn]: No match found for location with path "/_monaco/vs/loader.js"
witch block the app
@Thy3634
Try to remove node_modules
. Because it works with me.
When onMounted
is called, the editor hasn't been loaded yet, so editorRef
might be undefined
then.
After loading is completed, it should be the instance of the editor.
However, it was difficult to detect whether the editor loaded.
Therefore I added the event load
in v1.0.5.
The following code should work in this version:
<script setup>
const onEditorLoaded = (editor) => {
// `editor` is available!
}
</script>
<MonacoEditor @load="onEditorLoaded" />
No need to do that, vue mount child component first. and the monaco.editor.create
is sync function
I still blocked by this error [Vue Router warn]: No match found for location with path "/_monaco/vs/loader.js"
.
I removed pnpm store, and run nuxi cleanup
, then reinstall.
I'll try reinstall node.
I'm sorry. I was misunderstanding what the cause was and lacked in checking carefully.
I created a clean project and checked, found editorRef
is not undefined
since v1.0.4.
I tried using pnpm
in the following way:
pnpm dlx nuxi init nuxt-app
pnpm install --shamefully-hoist
pnpm add -D monaco-editor nuxt-monaco-editor
# add 'nuxt-monaco-editor' to `nuxt.config.ts` and your code to `app.vue`
pnpm run dev -o
I couldn't see [Vue Router warn]
then (also with npm
or yarn
.)
Could you tell me more details about the config, please?
It's a version mismatching mistake. I updated nuxt, OK now.
Thank you for your attention.
got this: