Server-side rendered page differs from client-side rendered page #448
-
I'm using VuePress 2 with Vite. To get mermaid to work, I have created a Vue component like this: <template>
<div class="mermaid">
<slot></slot>
</div>
</template>
<script>
export default {
async mounted() {
const mermaids = document.getElementsByClassName('mermaid')
console.log(mermaids)
const mermaid = await import("mermaid/dist/mermaid")
mermaid.initialize({
startOnLoad: true
})
mermaid.init()
}
}
</script> Which I then use like this in my <Mermaid>
{{`
graph LR
subgraph Project
a[Task A]
b[Task B]
c[Task C]
d[Task D]
end
`}}
</Mermaid> The reason the graph definition is in This always works good for me when I access the page after using My logic tells me the problem is that the problem with the first page load is because it's server rendered. Looking at the
The server-side rendered page does not work the same way as the client-rendered page, is this a bug? At least unexpected behavior for me. PS <Mermaid definition="
graph LR
subgraph Project
a[Task A]
b[Task B]
c[Task C]
d[Task D]
end
" /> DS |
Beta Was this translation helpful? Give feedback.
Replies: 1 comment
-
Try reading the code of It can avoid the issues and do have a better writing experience. Adding Syntax to markdown should be better than creating and using component Edited: relook what you are reporting, vue is using special comment to mark Mustache or directives like |
Beta Was this translation helpful? Give feedback.
Try reading the code of
vuepress-plugin-md-enhance
.It can avoid the issues and do have a better writing experience. Adding Syntax to markdown should be better than creating and using component
Edited: relook what you are reporting, vue is using special comment to mark Mustache or directives like
v-if
andv-for
, so the ssr render result is expected.