demo:optimize demo code

This commit is contained in:
pengfei.zhou
2020-01-06 10:43:18 +08:00
committed by osborn
parent 3b82935b24
commit 05b5c69080
25 changed files with 1860 additions and 1656 deletions

View File

@@ -16,6 +16,9 @@ export interface IFlowLayout extends IView {
columnCount?: number;
columnSpace?: number;
rowSpace?: number;
loadMore?: boolean;
onLoadMore?: () => void;
loadMoreView?: FlowLayoutItem;
}
export declare class FlowLayout extends Superview implements IFlowLayout {
private cachedViews;

View File

@@ -13,6 +13,9 @@ export interface IList extends IView {
renderItem: (index: number) => ListItem;
itemCount: number;
batchCount?: number;
onLoadMore?: () => void;
loadMore?: boolean;
loadMoreView?: ListItem;
}
export declare class List extends Superview implements IList {
private cachedViews;

View File

@@ -1,7 +1,7 @@
import { Superview, View, IView, NativeViewModel } from '../ui/view';
export declare function scroller(content: View): Scroller;
export declare function scroller(content: View, config?: IScroller): Scroller;
export interface IScroller extends IView {
content: View;
content?: View;
}
export declare class Scroller extends Superview implements IScroller {
content: View;

View File

@@ -15,9 +15,14 @@
*/
import { Superview } from '../ui/view';
import { layoutConfig } from '../util/layoutconfig';
export function scroller(content) {
export function scroller(content, config) {
return (new Scroller).also(v => {
v.layoutConfig = layoutConfig().fit();
if (config) {
for (let key in config) {
Reflect.set(v, key, Reflect.get(config, key, config), v);
}
}
v.content = content;
});
}