Browse Source

fix: setLoaded拿到外面去做

qufenxi
alan 5 years ago
parent
commit
c5b9b4d228
  1. 14
      src/modules/pages/connection/list/list.ts

14
src/modules/pages/connection/list/list.ts

@ -33,8 +33,7 @@ export class ConnectionList extends BI.LoadingPane {
} }
render() { render() {
const connectionLength = BI.size(this.model.connections); if (BI.size(this.model.connections) === 0) {
if (connectionLength === 0) {
return { return {
type: CenterAdapt, type: CenterAdapt,
items: [ items: [
@ -76,9 +75,6 @@ export class ConnectionList extends BI.LoadingPane {
type: LoadingBar, type: LoadingBar,
ref: (_ref: any) => { ref: (_ref: any) => {
this.loadingBar = _ref; this.loadingBar = _ref;
connectionLength > this.model.showItemNum ?
this.loadingBar.setLoaded() :
null;
}, },
handler: () => { handler: () => {
this.loadingBar.setLoading(); this.loadingBar.setLoading();
@ -89,6 +85,14 @@ export class ConnectionList extends BI.LoadingPane {
}; };
} }
created() {
if (this.model.showItemNum) {
BI.size(this.model.connections) > this.model.showItemNum ?
this.loadingBar.setLoaded() :
null;
}
}
private renderList(start = 0) { private renderList(start = 0) {
const itemNum = Math.min(this.model.connections.length, this.model.showItemNum); const itemNum = Math.min(this.model.connections.length, this.model.showItemNum);

Loading…
Cancel
Save