核心提示:1.页面引入2.页面引入了js 但是UE变量不能直接使用 可以写段js来绑定一下 如script type='text/ Date.prototype.UE=UE ;/script3.自定义控件ued...
1.页面引入
2.页面引入了js 但是UE变量不能直接使用 可以写段js来绑定一下 如
<script type="text/javascript">
Date.prototype.UE=UE ;
</script>
3.自定义控件ueditor.js
import React,{ Component } from 'react';
class Ueditor extends Component {
componentDidMount(){
var UE=new Date().UE;
try{UE.getEditor(this.props.id).destroy();}catch(err){}//再次初始化有问题 要销毁原来的
var editor = UE.getEditor(this.props.id, {
lang:"zh-cn" ,initialFrameHeight: this.props.height , initialFrameWidth: '100%'
});
var me = this;
editor.ready( function( ueditor ) {
var value = me.props.value?me.props.value:'
editor.setContent(value);
});
}
render(){
return (
)
}
}
export default Ueditor;
使用