fineui是帆软报表和BI产品线所使用的前端框架。
You can not select more than 25 topics
Topics must start with a letter or number, can include dashes ('-') and can be up to 35 characters long.
|
|
|
import { shortcut, Widget, createWidget, isNotEmptyString } from "@/core";
|
|
|
|
import { TextAreaEditor, Msg } from "@/base";
|
|
|
|
|
|
|
|
@shortcut()
|
|
|
|
export class CodeEditor extends Widget {
|
|
|
|
static xtype = "demo.textarea_editor";
|
|
|
|
|
|
|
|
props = { baseCls: "demo-editor" };
|
|
|
|
|
|
|
|
render() {
|
|
|
|
const editor = createWidget({
|
|
|
|
type: "bi.textarea_editor",
|
|
|
|
cls: "bi-border",
|
|
|
|
width: 600,
|
|
|
|
height: 400,
|
|
|
|
watermark: "请输入内容",
|
|
|
|
errorText: "检测内容有误",
|
|
|
|
validationChecker(v) {
|
|
|
|
return isNotEmptyString(v);
|
|
|
|
},
|
|
|
|
});
|
|
|
|
editor.on(TextAreaEditor.EVENT_FOCUS, () => {
|
|
|
|
Msg.toast("Focus");
|
|
|
|
});
|
|
|
|
editor.on(TextAreaEditor.EVENT_BLUR, () => {
|
|
|
|
Msg.toast("Blur");
|
|
|
|
});
|
|
|
|
createWidget({
|
|
|
|
type: "bi.vertical",
|
|
|
|
element: this,
|
|
|
|
hgap: 30,
|
|
|
|
vgap: 20,
|
|
|
|
items: [
|
|
|
|
editor,
|
|
|
|
{
|
|
|
|
type: "bi.button",
|
|
|
|
text: "getValue",
|
|
|
|
handler() {
|
|
|
|
Msg.toast(JSON.stringify(editor.getValue()));
|
|
|
|
},
|
|
|
|
},
|
|
|
|
{
|
|
|
|
type: "bi.button",
|
|
|
|
text: "setValue",
|
|
|
|
handler() {
|
|
|
|
editor.setValue("测试数据");
|
|
|
|
},
|
|
|
|
}
|
|
|
|
],
|
|
|
|
});
|
|
|
|
}
|
|
|
|
}
|