感觉不是很美观,但是基本功能还是有的
官网:.html
npm i wangeditor -S
<template><div id="wangeditor"><div ref="editorElem" style="text-align:left;"></div><el-button @click="handleConsole">尝试</el-button><div v-html="editorContent"></div></div>
</template><script>
import E from "wangeditor";
export default {name: '',data() {return {editor: null,editorContent: ''};},methods: {handleConsole:function(){console.log(this.editorContent)}},mounted(){this.editor = new E(this.$refs.editorElem);// 编辑器的事件,每次改变会获取其html内容this.hange = html => {this.editorContent = html;}; this.us = [// 菜单配置'head', // 标题'bold', // 粗体'fontSize', // 字号'fontName', // 字体'italic', // 斜体'underline', // 下划线'strikeThrough', // 删除线'foreColor', // 文字颜色'backColor', // 背景颜色'link', // 插入链接'list', // 列表'justify', // 对齐方式'quote', // 引用'emoticon', // 表情'image', // 插入图片'table', // 表格'code', // 插入代码'undo', // 撤销'redo' // 重复];this.editor.customConfig.uploadImgShowBase64 = true// 使用 base64 保存图片// this.editor.customConfig.uploadImgServer = '/upload' 这是上传图片到服务器ate(); // 创建富文本实例 },
}
</script><style scoped></style>
<div id="editor"></div><script type="text/javascript" src=".min.js"></script><script type="text/javascript">var E = window.wangEditorvar editor = new E('#editor')// 或者 var editor = new E( ElementById('editor') )ate()
</script>
本文发布于:2024-02-03 00:10:49,感谢您对本站的认可!
本文链接:https://www.4u4v.net/it/170689024747375.html
版权声明:本站内容均来自互联网,仅供演示用,请勿用于商业和其他非法用途。如果侵犯了您的权益请与我们联系,我们将在24小时内删除。
留言与评论(共有 0 条评论) |