summaryrefslogtreecommitdiff
path: root/src/App.vue
blob: 8f7b831a3dc9c1cb28ee5b49197e6696f1dca81f (plain)
1
2
3
4
5
6
7
8
9
10
11
12
13
14
15
16
17
18
19
20
21
22
23
24
25
26
27
28
29
30
31
32
33
34
35
36
37
38
39
40
41
<template>
  <div id="app">
    <router-view />
  </div>
</template>

<script>
export default {
  name: 'App',
  computed: {
    assetTag() {
      return this.$store.getters['global/assetTag'];
    },
  },
  watch: {
    assetTag: function (tag) {
      if (tag) {
        document.title = `${tag} - ${this.$route.meta.title}`;
      }
    },
    $route: function (to) {
      document.title = to.meta.title || 'Page is missing title';
      if (this.assetTag) {
        document.title = `${this.assetTag} - ${to.meta.title}`;
      }
    },
  },
  created() {
    document.title = this.$route.meta.title || 'Page is missing title';
    const theme = localStorage.getItem('user-theme');
    if (theme === null) {
      localStorage.setItem('user-theme', 'light-theme');
      document.documentElement.className = 'light-theme';
    }
  },
};
</script>

<style lang="scss">
/* Empty SCSS code: use prependData() */
</style>