Install
npm install
Usage
<template>
<VmMarkdown
:uploadImage="uploadImage"
theme="default" //dark, green, gray, princess
width="1000px"
height="600px"
@html-change="htmlChange"
/>
</template>
<script>
import VmMarkdown from "vm-markdown"
import "highlight.js/styles/github.css"
import hljs from 'highlight.js'
export default {
name: "app",
components: {
VmMarkdown
},
methods: {
htmlChange() {
this.$nextTick(() => {
const codes = document.querySelectorAll(".markdown-body pre code");
codes.forEach(elem => {
hljs.highlightBlock(elem);
});
});
},
async uploadImage(file) {
const imgUrl = await this.uploadRequest(file);
return imgUrl
}
}
}
</script>