Added live record timer

This commit is contained in:
Maximilian Giller 2021-11-07 23:13:46 +01:00
parent 98d19e5e0b
commit 6a96ef55c0
3 changed files with 19 additions and 2 deletions

View file

@ -104,6 +104,7 @@ export default {
data() { data() {
return { return {
iconScale: 1.6, iconScale: 1.6,
timerDelta: 0,
requiredFields: [ requiredFields: [
{ {
key: "project", key: "project",
@ -148,8 +149,18 @@ export default {
return fields; return fields;
} }
}, },
timers: {
"increaseTimer": { time: 1000, autostart: true, repeat: true }
},
methods: { methods: {
getDurationTimestamp: helperService.getDurationTimestamp, getDurationTimestamp: function(duration) {
var localDuration = duration;
if (this.running) {
localDuration += this.timerDelta;
}
return helperService.getDurationTimestamp(localDuration);
},
getProject: function(id) { getProject: function(id) {
var project = store.getters.getProjectById(id); var project = store.getters.getProjectById(id);
@ -164,6 +175,9 @@ export default {
}, },
detailsRecord: function(id) { detailsRecord: function(id) {
this.$router.push("/record/" + id); this.$router.push("/record/" + id);
},
increaseTimer: function() {
this.timerDelta++;
} }
} }
}; };

View file

@ -3,9 +3,12 @@ import App from "./App.vue";
import router from "./router"; import router from "./router";
import store from "./store"; import store from "./store";
import { BootstrapVue, BootstrapVueIcons } from "bootstrap-vue"; import { BootstrapVue, BootstrapVueIcons } from "bootstrap-vue";
import VueTimers from 'vue-timers'
Vue.config.productionTip = false; Vue.config.productionTip = false;
Vue.use(VueTimers);
// Install BootstrapVue // Install BootstrapVue
Vue.use(BootstrapVue); Vue.use(BootstrapVue);
Vue.use(BootstrapVueIcons); Vue.use(BootstrapVueIcons);

View file

@ -6,7 +6,7 @@
<ul> <ul>
<li>Added credits page</li> <li>Added credits page</li>
<li>Created basic footer</li> <li>Created basic footer</li>
<li>Added live timer in record list</li> <li>Added live record timer</li>
</ul> </ul>
<BaseTitle size="small"> <BaseTitle size="small">
27.07.2021 27.07.2021