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

@@ -1957,12 +1957,9 @@ var Slider = /** @class */ (function (_super) {
return this.cachedViews.values();
};
Slider.prototype.getItem = function (itemIdx) {
var view = this.cachedViews.get("" + itemIdx);
if (view === undefined) {
view = this.renderPage(itemIdx);
view.superview = this;
this.cachedViews.set("" + itemIdx, view);
}
var view = this.renderPage(itemIdx);
view.superview = this;
this.cachedViews.set("" + itemIdx, view);
return view;
};
Slider.prototype.isDirty = function () {
@@ -2004,6 +2001,10 @@ var Slider = /** @class */ (function (_super) {
Property,
__metadata$6("design:type", Function)
], Slider.prototype, "onPageSlided", void 0);
__decorate$6([
Property,
__metadata$6("design:type", Boolean)
], Slider.prototype, "loop", void 0);
return Slider;
}(Superview));
function slider(config) {

View File

@@ -1457,12 +1457,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() {
@@ -1503,6 +1500,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) {

View File

@@ -2916,12 +2916,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() {
@@ -2962,6 +2959,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) {