|
@@ -123,6 +123,7 @@ export default {
|
|
|
this.isAnimation && this.duration > 0
|
|
this.isAnimation && this.duration > 0
|
|
|
? this.scrollAnimation()
|
|
? this.scrollAnimation()
|
|
|
: this.scroll();
|
|
: this.scroll();
|
|
|
|
|
+ this.$emit("click");
|
|
|
},
|
|
},
|
|
|
scrollAnimation() {
|
|
scrollAnimation() {
|
|
|
const self = this;
|
|
const self = this;
|
|
@@ -133,12 +134,13 @@ export default {
|
|
|
var y = (t * -self.scrollTop) / self.duration + self.scrollTop;
|
|
var y = (t * -self.scrollTop) / self.duration + self.scrollTop;
|
|
|
self.scroll(y);
|
|
self.scroll(y);
|
|
|
cid = self.requestAniFrame()(fn);
|
|
cid = self.requestAniFrame()(fn);
|
|
|
- if (t == self.duration) {
|
|
|
|
|
|
|
+ if (t == self.duration || y == 0) {
|
|
|
window.cancelAnimationFrame(cid);
|
|
window.cancelAnimationFrame(cid);
|
|
|
}
|
|
}
|
|
|
});
|
|
});
|
|
|
},
|
|
},
|
|
|
scroll(y = 0) {
|
|
scroll(y = 0) {
|
|
|
|
|
+ console.log(y);
|
|
|
if (this.scrollEl === window) {
|
|
if (this.scrollEl === window) {
|
|
|
window.scrollTo(0, y);
|
|
window.scrollTo(0, y);
|
|
|
} else {
|
|
} else {
|