6 changed files with 82 additions and 10 deletions
@ -1,5 +1,7 @@ |
|||
import { withInstall } from '/@/utils'; |
|||
import markDown from './src/Markdown.vue'; |
|||
import markDownViewer from './src/MarkdownViewer.vue'; |
|||
|
|||
export const MarkDown = withInstall(markDown); |
|||
export const MarkdownViewer = withInstall(markDownViewer); |
|||
export * from './src/typing'; |
|||
|
|||
@ -0,0 +1,22 @@ |
|||
<template> |
|||
<div v-html="getHtmlData" :class="$props.class" class="markdown-viewer"></div> |
|||
</template> |
|||
|
|||
<script lang="ts" setup> |
|||
import { computed } from 'vue'; |
|||
import showdown from 'showdown'; |
|||
|
|||
const converter = new showdown.Converter(); |
|||
converter.setOption('tables', true); |
|||
const props = defineProps({ |
|||
value: { type: String }, |
|||
class: { type: String }, |
|||
}); |
|||
const getHtmlData = computed(() => converter.makeHtml(props.value || '')); |
|||
</script> |
|||
|
|||
<style scoped> |
|||
.markdown-viewer { |
|||
width: 100%; |
|||
} |
|||
</style> |
|||
Loading…
Reference in new issue