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.
 
 
 

86 lines
2.6 KiB

import { shortcut, Widget, map, range, deepClone } from "@/core";
import { ButtonGroup } from "@/base";
@shortcut()
export class Func extends Widget {
static xtype = "demo.virtual_group";
props = { baseCls: "demo-func" };
_createItems() {
const items = map(range(1000), i => {
return {
type: "demo.virtual_group_item",
value: i,
key: i + 1,
};
});
return items;
}
render() {
const self = this;
const buttonGroupItems = self._createItems();
const virtualGroupItems = self._createItems();
return {
type: "bi.vertical",
vgap: 20,
items: [
{
type: "bi.label",
cls: "layout-bg5",
height: 50,
text: "共1000个元素,演示button_group和virtual_group每次删除第一个元素,打开控制台看输出",
},
{
type: "bi.button_group",
width: 500,
height: 300,
ref() {
self.buttonGroup = this;
},
chooseType: ButtonGroup.CHOOSE_TYPE_MULTI,
layouts: [
{
type: "bi.vertical",
}
],
items: this._createItems(),
},
{
type: "bi.button",
text: "演示button_group的刷新",
handler() {
buttonGroupItems.shift();
self.buttonGroup.populate(deepClone(buttonGroupItems));
},
},
{
type: "bi.virtual_group",
width: 500,
height: 300,
ref() {
self.virtualGroup = this;
},
chooseType: ButtonGroup.CHOOSE_TYPE_MULTI,
layouts: [
{
type: "bi.vertical",
}
],
items: this._createItems(),
},
{
type: "bi.button",
text: "演示virtual_group的刷新",
handler() {
virtualGroupItems.shift();
self.virtualGroup.populate(deepClone(virtualGroupItems));
},
}
],
};
}
}