1.安装富文本编辑器:npm i react-quill
2.页面中引入
import ReactQuill from react-quill ;
import quill/dist/quill.snow.css ;
3.自定义配置
const modules = {
toolbar: {
container: [
[{ header: [1, 2, 3, 4, 5, 6, false] }],
[ bold , italic , underline , strike ],
[{ list: ordered }, { list: bullet }],
[{ align: [] }],
[{ color: [] }, { background: [] }],
[ link , image ],
[ clean ],
],
//如果不自定义上传下面的可以不要
handlers: {
image() {
imageHandler.call(this, props.action);
},
},
},
};
const options = {
modules: modules,
ref: refs,
}
4.页面中使用,可自定义图片上传

5.自定义图片上传

© 版权声明
文章版权归作者所有,未经允许请勿转载。
相关文章
暂无评论...