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.

53 lines
1.5 KiB

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({
8 years ago
type: "bi.textarea_editor",
6 years ago
cls: "bi-border",
8 years ago
width: 600,
6 years ago
height: 400,
watermark: "请输入内容",
errorText: "检测内容有误",
validationChecker(v) {
return isNotEmptyString(v);
},
8 years ago
});
editor.on(TextAreaEditor.EVENT_FOCUS, () => {
Msg.toast("Focus");
8 years ago
});
editor.on(TextAreaEditor.EVENT_BLUR, () => {
Msg.toast("Blur");
8 years ago
});
createWidget({
8 years ago
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("测试数据");
},
8 years ago
}
],
7 years ago
});
8 years ago
}
}