e-chan1007 / nuxt-monaco-editor

Integrate monaco-editor with Nuxt
https://e-chan1007.github.io/nuxt-monaco-editor
MIT License
119 stars 16 forks source link

Changing v-model ignores second change #13

Closed Gruce closed 2 years ago

Gruce commented 2 years ago

Hello,

I have this code:

<template>
    <div h="screen">
        <div>
            <button @click="test1">test 1</button>
            <button @click="test2">test 2</button>
        </div>
        <MonacoEditor h="full" v-model="code" lang="html" :options="{ theme: 'vs-dark', fontSize: '20px' }" />
    </div>
</template>

<script setup>
const code = ref(null)

const test1 = () => {
    code.value = `<div>test 1</div>`
}

const test2 = () => {
    code.value = `<div>test 2</div>`
}
</script>

code changes on the editor on the first call function, second function not changing the code in the editor.

Thank you.

e-chan1007 commented 2 years ago

I fixed this in v1.0.5. It should work now!