forked from fanruan/fineui-start
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.
83 lines
2.9 KiB
83 lines
2.9 KiB
6 years ago
|
!(function () {
|
||
|
var List = BI.inherit(BI.Widget, {
|
||
|
|
||
|
props: {
|
||
|
baseCls: "my-todolist-list",
|
||
|
text: "正在进行"
|
||
|
},
|
||
|
|
||
|
render: function () {
|
||
|
var self = this, o = this.options;
|
||
|
return {
|
||
|
type: "bi.vertical",
|
||
|
items: [
|
||
|
{
|
||
|
el: {
|
||
|
type: "bi.vertical_adapt",
|
||
|
height: 40,
|
||
|
items: [
|
||
|
{
|
||
|
type: "bi.label",
|
||
|
cls: "my-todolist-list-text",
|
||
|
textAlign: "left",
|
||
|
text: o.text,
|
||
|
width: 580
|
||
|
}, {
|
||
|
type: "bi.center_adapt",
|
||
|
cls: "my-todolist-list-count-container",
|
||
|
width: 20,
|
||
|
height: 20,
|
||
|
items: [
|
||
|
{
|
||
|
el: {
|
||
|
type: "bi.label",
|
||
|
ref: function (_ref) {
|
||
|
self.count = _ref;
|
||
|
},
|
||
|
text: "0"
|
||
|
}
|
||
|
}
|
||
|
]
|
||
|
}
|
||
|
]
|
||
|
}
|
||
|
}, {
|
||
|
type: "bi.button_group",
|
||
|
ref: function (_ref) {
|
||
|
self.list = _ref;
|
||
|
},
|
||
|
layouts: [
|
||
|
{
|
||
|
type: "bi.vertical",
|
||
|
vgap: 10
|
||
|
}
|
||
|
],
|
||
|
items: o.items,
|
||
|
listeners: [
|
||
|
{
|
||
|
eventName: "EVENT_CHANGE",
|
||
|
action: function (v) {
|
||
|
self.fireEvent("EVENT_CHANGE", v);
|
||
|
}
|
||
|
}
|
||
|
]
|
||
|
}
|
||
|
]
|
||
|
};
|
||
|
},
|
||
|
|
||
|
_createItems: function (items) {
|
||
|
return BI.createItems(items, this.options.el);
|
||
|
},
|
||
|
|
||
|
_setCount: function (count) {
|
||
|
this.count.setText(count);
|
||
|
},
|
||
|
|
||
|
populate: function (items) {
|
||
|
this.list.populate(this._createItems(items));
|
||
|
this._setCount(items.length);
|
||
|
}
|
||
|
});
|
||
|
BI.shortcut("my.todolist.list", List);
|
||
|
})();
|