add loop property & fix bug caused by renderPage cache

This commit is contained in:
王劲鹏
2020-04-09 16:58:47 +08:00
committed by osborn
parent d1f32b7f5c
commit c44c3e5353
12 changed files with 58 additions and 39 deletions

View File

@@ -2974,12 +2974,9 @@ class Slider extends Superview {
return this.cachedViews.values();
}
getItem(itemIdx) {
let view = this.cachedViews.get(`${itemIdx}`);
if (view === undefined) {
view = this.renderPage(itemIdx);
view.superview = this;
this.cachedViews.set(`${itemIdx}`, view);
}
let view = this.renderPage(itemIdx);
view.superview = this;
this.cachedViews.set(`${itemIdx}`, view);
return view;
}
isDirty() {
@@ -3020,6 +3017,10 @@ __decorate$6([
Property,
__metadata$6("design:type", Function)
], Slider.prototype, "onPageSlided", void 0);
__decorate$6([
Property,
__metadata$6("design:type", Boolean)
], Slider.prototype, "loop", void 0);
function slider(config) {
const ret = new Slider;
for (let key in config) {

File diff suppressed because one or more lines are too long