Closed winneryong closed 3 days ago
This is how the code libraries work. To have the code update you would need to re-render the component. A quick and dirty method would be to give the code block element a key, and when the code changes, change the key.
ex.
<template>
<VCodeBlock
:key="blockKey"
:code="code"
highlightjs
lang="js"
/>
<button @click="code = `const foo = 'bar';`; blockKey = 2;">Change Code</button>
</template>
<script setup>
const code = ref(`const foo = 'foo';`);
const blockKey = ref(1);
</script>
Vue Code Block Version
2.3.3
Vue Version
3
Bug description
When the
code
value is updated to be empty, the displayed content does not update.Steps to reproduce
code
value<html><body>123</body></html>
<html><body>123</body></html>
code
value to empty string ``<html><body>123</body></html>
Relevant log output
No response
Additional context
No response
Code of Conduct