React后台管理系统-rich-editor组件
1.Simditor组件的github地址:https://github.com/mycolorway/simditor 网址:http://simditor.tower.im/
2.在util里边新建rich-editor文件夹,里边新建index.jsx
- import React from 'react';
 - import Simditor from 'simditor';
 - import 'simditor/styles/simditor.scss';
 - import './index.scss';
 - // 通用的富文本编辑器,依赖jquery
 - class RichEditor extends React.Component{
 - constructor(props){
 - super(props);
 - }
 - componentDidMount(){
 - this.loadEditor();
 - }
 - loadEditor(){
 - let element=this.refs["textarea"];
 - this.simditor=new Simditor({
 - textarea: $(element),
 - defaultValue: this.props.placeholder || "请输入内容",
 - upload: {
 - url : '/manage/product/richtext_img_upload.do',
 - defaultImage : '',
 - fileKey : 'upload_file'
 - }
 - });
 - //上传数据
 - this.bindEditorEvent();
 - }
 - //初始化富文本编辑器的事件
 - bindEditorEvent(){
 - this.simditor.on("valuechanged", e => {
 - this.props.onValueChange(this.simditor.getValue())
 - })
 - }
 - render(){
 - return (
 - <div className="rich-editor">
 - <textarea ref="textarea"></textarea>
 - </div>
 - );
 - }
 - }
 - export default RichEditor;
 
3.在save.jsx里边使用RichEditor组件
- import RichEditor from 'util/rich-editor/index.jsx'
 - <div className="form-group">
 - <label className="col-md-2 control-label">商品详情</label>
 - <div className="col-md-10">
 - <RichEditor onValueChange={(value) => {this.onDetailValueChange(value)}}/>
 - </div>
 - </div>
 
4.在RichEditor里边定义valuechanged事件,监听文本编辑器里边内容的变化,当内容变化时触发 valuechange事件,调用onDetailValueChange函数,传入新的内容,更新state里边detail的值
- //富文本编辑器
 - onDetailValueChange(value){
 - this.setState({
 - detail : value
 - })
 - }
 
React后台管理系统-rich-editor组件的更多相关文章
- React后台管理系统-添加商品组件
		
引入了CategorySelector 二级联动组件.FileUploader图片上传组件和RichEditor富文本编辑组件 import React from 'react'; import MU ...
 - React后台管理系统- rc-pagination分页组件封装
		
1.用户列表页面使用的rc-pagination分页组件 Github地址: https://github.com/react-component/pagination 2.安装 cnpm insta ...
 - React后台管理系统-首页Home组件
		
1.Home组件要显示用户总数.商品总数和订单总数,数据请求后端的 /manage/statistic/base_count.do接口,返回的是 this.state = { u ...
 - 《React后台管理系统实战 :一》:目录结构、引入antd、引入路由、写login页面、使用antd的form登录组件、form前台验证、高阶函数/组件
		
实战 上接,笔记:https://blog.csdn.net/u010132177/article/details/104150177 https://gitee.com/pasaulis/react ...
 - 【共享单车】—— React后台管理系统开发手记:主页面架构设计
		
前言:以下内容基于React全家桶+AntD实战课程的学习实践过程记录.最终成果github地址:https://github.com/66Web/react-antd-manager,欢迎star. ...
 - react后台管理系统路由方案及react-router原理解析
		
最近做了一个后台管理系统主体框架是基于React进行开发的,因此系统的路由管理,选用了react-router(4.3.1)插件进行路由页面的管理配置. 实现原理剖析 1.hash的方式 ...
 - 《React后台管理系统实战 :三》header组件:页面排版、天气请求接口及页面调用、时间格式化及使用定时器、退出函数
		
一.布局及排版 1.布局src/pages/admin/header/index.jsx import React,{Component} from 'react' import './header. ...
 - 《React后台管理系统实战 :二》antd左导航:cmd批量创建子/目录、用antd进行页面布局、分离左导航为单独组件、子路由、动态写左导航、css样式相对陷阱
		
一.admin页面布局及路由创建 0)cmd批量创建目录及子目录 //创建各个目录,及charts和子目录bar md home category product role user charts\b ...
 - 【共享单车】—— React后台管理系统开发手记:UI菜单各个组件使用(Andt UI组件)
		
前言:以下内容基于React全家桶+AntD实战课程的学习实践过程记录.最终成果github地址:https://github.com/66Web/react-antd-manager,欢迎star. ...
 - 【共享单车】—— React后台管理系统开发手记:AntD Form基础组件
		
前言:以下内容基于React全家桶+AntD实战课程的学习实践过程记录.最终成果github地址:https://github.com/66Web/react-antd-manager,欢迎star. ...
 
随机推荐
- Codeforces Round #364 (Div. 2) B
			
Description Vasya has the square chessboard of size n × n and m rooks. Initially the chessboard is e ...
 - Telerik RadPropertyGrid 设置显隐 Combox选择
			
Telerik RadPropertyGrid 的排序按钮.搜索框和描述面板的显隐只要设置SortAndGroupButtons.SearchBox.DescriptionPanel的属性值改为Vis ...
 - 016 3Sum Closest 最接近的三数之和
			
Given an array S of n integers, find three integers in S such that the sum is closest to a given num ...
 - linux下各种格式软件的安装(引用http://blog.csdn.net/zyz511919766/article/details/7574040)
			
首先介绍两个简单的方式 第一:sudo apt-get install packagename 命令 如果我们知道我们要安装的软件的确切的名称,那么我们可以简单的通过此条命令来获取和安装软件.apt- ...
 - Unity 碰撞的条件
 - (转)CentOS系统启动流程图文详解
			
CentOS系统启动流程图文详解. 原文:http://www.linuxidc.com/Linux/2017-03/141966.htm 熟悉系统启动流程对于我们学习Linux系统是非常有帮助的,虽 ...
 - HDU 5505——GT and numbers——————【素数】
			
GT and numbers Time Limit: 2000/1000 MS (Java/Others) Memory Limit: 65536/65536 K (Java/Others)To ...
 - gitk更改主题设置打不开
			
➜ project git:(master) gitk Error in startup script: unknown color name "lime" (processing ...
 - 在Magento System Configuration页面添加配置项
			
以 Jp_Coupon 模块为例: 目标: 在 System configuration 页面添加一个 JP tab, 在JP中添加 Coupon section, 然后给 Coupon sectio ...
 - vs移动团队项目集合
			
vs移动团队项目集合: https://msdn.microsoft.com/zh-cn/library/vs/alm/dd936138(v=vs.120)/css