-
Notifications
You must be signed in to change notification settings - Fork 0
Commit
This commit does not belong to any branch on this repository, and may belong to a fork outside of the repository.
- Loading branch information
Showing
4 changed files
with
55 additions
and
41 deletions.
There are no files selected for viewing
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Original file line number | Diff line number | Diff line change |
---|---|---|
@@ -1,45 +1,46 @@ | ||
<template lang="pug"> | ||
q-page(padding) | ||
.text-h5.text-center History | ||
.text-center The last {{limit}} symbols you've opened, will appear here. | ||
.text-center(v-if="dreams.length<1") But it seems you haven't checked anything out. | ||
q-list(bordered, separator, v-if="dreams.length>0" style="margin-top:10px") | ||
q-item(clickable, v-ripple, v-for="dream in dreams", @click="goToDream(dream.id)") | ||
q-item-label | ||
.text-h6 {{dream.symbol}} | ||
q-page(padding) | ||
.text-h5.text-center History | ||
.text-center The last {{limit}} symbols you've opened, will appear here. | ||
.text-center(v-if="dreams.length<1") But it seems you haven't checked anything out. | ||
q-list(bordered, separator, v-if="dreams.length>0" style="margin-top:10px") | ||
q-item(clickable, v-ripple, v-for="dream in dreams", @click="goToDream(dream.id)") | ||
q-item-label.flex | ||
.self-center {{dream.symbol}} | ||
|
||
|
||
|
||
</template> | ||
|
||
<script lang="ts"> | ||
import { Vue, Component } from 'vue-property-decorator' | ||
import {SymbolModel} from '../models/models'; | ||
import * as DreamDB from '../utils/dreams' | ||
import { Vue, Component } from 'vue-property-decorator'; | ||
import { SymbolModel } from '../models/models'; | ||
import * as DreamDB from '../utils/dreams'; | ||
@Component | ||
export default class History extends Vue { | ||
limit=50; | ||
dreams = new Array<SymbolModel>(); | ||
created() { | ||
this.$root.$on('reloadHistory' , this.reloadHistory); | ||
} | ||
mounted() { | ||
this.reloadHistory(); | ||
} | ||
async reloadHistory() { | ||
// this.dreams =this.$store.getters.getHistory; | ||
const lsh = await this.$store.getters.getLocalForage.getItem('history'); | ||
if(lsh==null){return;} | ||
const dreamIds = JSON.parse(lsh) as number[]; | ||
dreamIds.forEach(did => { //Did you though? | ||
this.dreams.push(DreamDB.getDream(did)); | ||
}); | ||
} | ||
goToDream(id:number){ | ||
console.log(id); | ||
sessionStorage.setItem('CurrentDreamId', id.toString()); | ||
this.$root.$emit('setCurrDreamId', id); | ||
this.$router.push('/Symbol'); | ||
} | ||
limit = 50; | ||
dreams = new Array<SymbolModel>(); | ||
created() { | ||
this.$root.$on('reloadHistory', this.reloadHistory); | ||
} | ||
mounted() { | ||
this.reloadHistory(); | ||
} | ||
async reloadHistory() { | ||
// this.dreams =this.$store.getters.getHistory; | ||
const lsh = await this.$store.getters.getLocalForage.getItem('history'); | ||
if (lsh == null) { | ||
return; | ||
} | ||
const dreamIds = JSON.parse(lsh) as number[]; | ||
dreamIds.forEach((did) => { | ||
//Did you though? | ||
this.dreams.push(DreamDB.getDream(did)); | ||
}); | ||
} | ||
goToDream(id: number) { | ||
console.log(id); | ||
sessionStorage.setItem('CurrentDreamId', id.toString()); | ||
this.$root.$emit('setCurrDreamId', id); | ||
this.$router.push('/Symbol'); | ||
} | ||
} | ||
</script> |
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters