editormd官网
1、将edmitor.md-master
目录放在Vue项目的public
目录下
2、在 public/index.html
下编辑
<script src="https://cdn.bootcss.com/jquery/1.11.3/jquery.min.js"></script>
<link rel="stylesheet" href="<%= BASE_URL %>editor.md-master/css/editormd.css" />
<script src="<%= BASE_URL %>editor.md-master/editormd.min.js"></script>
3、将edmitormd
封装成组件
<template>
<div id="editormdid">
<textarea v-model="content"></textarea>
</div>
</template>
<script>
export default {
name: 'Editor',
props: {
content:{
type: String,
default: ''
}
},
data() {
return {
instance: null,
};
},
mounted() {
this.initEditor();
},
methods: {
initEditor() {
this.instance = window.editormd("editormdid", {
height: 500,
emoji: true,
path: 'editor.md-master/lib/'
});
}
},
};
</script>
网友评论