You can not select more than 25 topics
Topics must start with a letter or number, can include dashes ('-') and can be up to 35 characters long.
42 lines
1.5 KiB
42 lines
1.5 KiB
define([
|
|
'text!./index.html',
|
|
'css!./index.css'
|
|
], function(html) {
|
|
return {
|
|
props: ['rebateMoney'],
|
|
data: function () {
|
|
return {
|
|
top: 0,
|
|
ticking: false,
|
|
innerHeight: window.innerHeight,
|
|
maxHeight: 0
|
|
};
|
|
},
|
|
mounted: function () {
|
|
this.$nextTick(function () {
|
|
this.top = this.maxHeight = this.innerHeight - this.$refs.rebate.offsetHeight - this.$refs.close.offsetHeight + this.$refs.close.offsetTop;
|
|
});
|
|
},
|
|
methods: {
|
|
rebateAction: function (value) {
|
|
this.$emit('rebate-action', value);
|
|
},
|
|
touchMove: function (event) {
|
|
if (!this.ticking) {
|
|
window.requestAnimationFrame(function () {
|
|
this.ticking = false;
|
|
if (event.changedTouches[0].clientY < this.$refs.close.offsetHeight - this.$refs.close.offsetTop) {
|
|
this.top = this.$refs.close.offsetHeight - this.$refs.close.offsetTop;
|
|
} else if (event.changedTouches[0].clientY > this.maxHeight) {
|
|
this.top = this.maxHeight;
|
|
} else {
|
|
this.top = event.changedTouches[0].clientY;
|
|
}
|
|
}.bind(this));
|
|
}
|
|
this.ticking = true;
|
|
}
|
|
},
|
|
template: html
|
|
};
|
|
}); |