vue3 常规引入,预览区不展示内容
kvchen95 opened this issue · 3 comments
kvchen95 commented
// package.json
"dependencies": {
"@bytemd/plugin-gfm": "^1.20.2",
"@bytemd/plugin-highlight": "^1.20.2",
"@bytemd/plugin-math": "^1.20.2",
"@bytemd/vue": "^1.20.2",
"@bytemd/vue-next": "^1.20.2",
"axios": "^1.3.2",
"bytemd": "^1.20.2",
"pinia": "^2.0.28",
"uid": "^2.0.1",
"vue": "^3.2.45",
"vue-router": "^4.1.6"
},
// md.vue
<template>
<div>
<!-- <Viewer :value="content" :plugins="plugins"></Viewer> -->
<Editor v-model="content" :plugins="plugins"></Editor>
</div>
</template>
<script lang="ts" setup>
import { ref } from 'vue'
// @ts-ignore
import { Editor, Viewer } from '@bytemd/vue-next'
import 'bytemd/dist/index.css'
import gfm from '@bytemd/plugin-gfm'
import highlight from '@bytemd/plugin-highlight'
import math from '@bytemd/plugin-math'
const content = ref('')
const plugins = [gfm(), highlight(), math()]
</script>
CPunisher commented
按照 vue3 的 example: https://github.com/bytedance/bytemd/blob/main/examples/vue3/src/App.vue
把 <Editor>
上的 v-model
改成 :value
和 @change
kvchen95 commented
按照 vue3 的 example: https://github.com/bytedance/bytemd/blob/main/examples/vue3/src/App.vue 把
<Editor>
上的v-model
改成:value
和@change
thanks!
darkchan commented