(Q&A and Idea) How do i set html default value in Vue dom? #985
Answered by
Saul-Mirone
Apr 22, 2023
Replies: 1 comment 1 reply
|
The dom hasn't been rendered for vue in your case, move the markdown variable into <script setup lang="ts">
import { Milkdown, useEditor } from '@milkdown/vue';
import { defaultValueCtx, Editor, rootCtx } from '@milkdown/core';
import { nord } from '@milkdown/theme-nord'
import { commonmark } from '@milkdown/preset-commonmark'
useEditor((root) => {
return Editor.make()
.config(nord)
.config((ctx) => {
ctx.set(rootCtx, root)
ctx.set(defaultValueCtx, {
type: 'html',
dom: document.querySelector('#pre'),
})
})
.use(commonmark)
})
</script>
<template>
<div id="pre">
<h1>Milkdown Vue Commonmark</h1>
</div>
<Milkdown />
</template> |
1 reply
Answer selected by
Nemure231
Sign up for free
to join this conversation on GitHub.
Already have an account?
Sign in to comment

The dom hasn't been rendered for vue in your case, move the markdown variable into
onMounted: