weapp版本升级到1.11.7
"version": "1.11.7"
This commit is contained in:
1 parent
a3c886146a
commit
66ba21dd7b
67 files changed
+566
-365
No files matched your search
+19
-12
@@ -64,7 +64,7 @@ var utils_1 = require("../common/utils");
|
||||
(0, utils_1.getRect)(_this, '.van-notice-bar__wrap'),
|
||||
]).then(function (rects) {
|
||||
var contentRect = rects[0], wrapRect = rects[1];
|
||||
var _a = _this.data, speed = _a.speed, scrollable = _a.scrollable, delay = _a.delay;
|
||||
var scrollable = _this.data.scrollable;
|
||||
if (contentRect == null ||
|
||||
wrapRect == null ||
|
||||
!contentRect.width ||
|
||||
@@ -73,20 +73,26 @@ var utils_1 = require("../common/utils");
|
||||
return;
|
||||
}
|
||||
if (scrollable || wrapRect.width < contentRect.width) {
|
||||
var duration = ((wrapRect.width + contentRect.width) / speed) * 1000;
|
||||
_this.wrapWidth = wrapRect.width;
|
||||
_this.contentWidth = contentRect.width;
|
||||
_this.duration = duration;
|
||||
_this.animation = wx.createAnimation({
|
||||
duration: duration,
|
||||
timingFunction: 'linear',
|
||||
delay: delay,
|
||||
});
|
||||
_this.initAnimation(wrapRect.width, contentRect.width);
|
||||
_this.scroll(true);
|
||||
}
|
||||
});
|
||||
});
|
||||
},
|
||||
initAnimation: function (warpWidth, contentWidth) {
|
||||
var _a = this.data, speed = _a.speed, delay = _a.delay;
|
||||
this.wrapWidth = warpWidth;
|
||||
this.contentWidth = contentWidth;
|
||||
// begin 0
|
||||
this.contentDuration = (contentWidth / speed) * 1000;
|
||||
// begin -wrapWidth
|
||||
this.duration = ((warpWidth + contentWidth) / speed) * 1000;
|
||||
this.animation = wx.createAnimation({
|
||||
duration: this.contentDuration,
|
||||
timingFunction: 'linear',
|
||||
delay: delay,
|
||||
});
|
||||
},
|
||||
scroll: function (isInit) {
|
||||
var _this = this;
|
||||
if (isInit === void 0) { isInit = false; }
|
||||
@@ -98,17 +104,18 @@ var utils_1 = require("../common/utils");
|
||||
.step()
|
||||
.export(),
|
||||
});
|
||||
var duration = isInit ? this.contentDuration : this.duration;
|
||||
(0, utils_1.requestAnimationFrame)(function () {
|
||||
_this.setData({
|
||||
animationData: _this.animation
|
||||
.translateX(-_this.contentWidth)
|
||||
.step()
|
||||
.step({ duration: duration })
|
||||
.export(),
|
||||
});
|
||||
});
|
||||
this.timer = setTimeout(function () {
|
||||
_this.scroll();
|
||||
}, this.duration + this.data.delay);
|
||||
}, duration + this.data.delay);
|
||||
},
|
||||
onClickIcon: function (event) {
|
||||
if (this.data.mode === 'closeable') {
|
||||
|
||||
Reference in new issue
Block a user