Improve warp

This commit is contained in:
syuilo
2019-04-18 22:00:11 +09:00
parent 8aaab195c6
commit fda8cf77ed
7 changed files with 47 additions and 7 deletions

View File

@@ -17,10 +17,12 @@ export default Vue.extend({
data() {
return {
date: null,
makePromise: cursor => this.$root.api('users/notes', {
userId: this.user.id,
limit: fetchLimit + 1,
withFiles: this.withMedia,
untilDate: cursor ? undefined : (this.date ? this.date.getTime() : undefined),
untilId: cursor ? cursor : undefined
}).then(notes => {
if (notes.length == fetchLimit + 1) {
@@ -37,6 +39,20 @@ export default Vue.extend({
}
})
};
},
created() {
this.$root.$on('warp', this.warp);
this.$once('hook:beforeDestroy', () => {
this.$root.$off('warp', this.warp);
});
},
methods: {
warp(date) {
this.date = date;
(this.$refs.timeline as any).reload();
}
}
});
</script>