富文本 Richeditor
Constructor
Implements: Widget
Tutorials: 控件对象使用快速入门
可设置的属性
Name | Type | Description |
---|---|---|
name | String | 控件的名字,唯一标志 |
title | String | 控件title |
hidden | Boolean | 隐藏 |
value | String | 值 |
readonly | Boolean | 只读 |
width | Number | 宽 |
height | Number | 高 |
uploadUrl | String | 上传地址 |
可读取的属性
Name | Type | Description |
---|---|---|
name | String | 控件的名字,唯一标志 |
title | String | 控件title |
hidden | Boolean | 隐藏 |
value | String | 值 |
readonly | Boolean | 只读 |
width | Number | 宽 |
height | Number | 高 |
uploadUrl | String | 上传地址 |
方法
getPlainTxt
Description: 获取纯文本内容,保留段落格式
返回值:Object|Array.<Object> mulitSelect设置为可以多选时返回数组 否则返回一行的数据对象
调用举例:
var widget = vjsp.Parser.getWidgetByName('richeditor');
var selected = widget.doMethod('getPlainTxt');
getContentTxt
Description: 获取春文本内容,不保留段落格式
返回值:Object|Array.<Object> mulitSelect设置为可以多选时返回数组 否则返回一行的数据对象
调用举例:
var widget = vjsp.Parser.getWidgetByName('richeditor');
var selected = widget.doMethod('getContentTxt');
事件
change
Description: 值改变
绑定举例:
var widget = vjsp.Parser.getWidgetByName('richeditor');
widget.on('change' , function(){
//控制台输出新值
console.info('new value' , this.get('value'));
});
hidden
Description: 隐藏事件(隐藏显示触发 回调参数为隐藏状态)
回调函数参数
Name | Type | Description |
---|---|---|
hiddenState | Boolean | 隐藏状态true 为隐藏、false 为取消隐藏 |
绑定举例:
var widget = vjsp.Parser.getWidgetByName('richeditor');
widget.on('hidden' , function(hiddenState){
if(hiddenState){
vjsp.alert('控件被隐藏');
}else{
vjsp.alert('控件取消隐藏');
}
});
readonly
Description: 只读事件 (只读状态改变触发 回调参数为只读状态)
回调函数参数
Name | Type | Description |
---|---|---|
readonlyState | Boolean | 只读状态 true 为只读、false 为取消只读 |
绑定举例:
var widget = vjsp.Parser.getWidgetByName('richeditor');
widget.on('readonly' , function(readonlyState){
if(readonlyState){
vjsp.alert('控件只读');
}else{
vjsp.alert('控件取消只读');
}
});