aboutsummaryrefslogtreecommitdiffstats
path: root/frontend/src/app.js
blob: caf09f552b386f1758359d0afa68d63147008dcd (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
42
43
44
import Utils from "utils";
import Navbar from "components/navbar.vue";

export default {
  replace: false,
  components: { "navbar": Navbar },
  data() {
    return {
      flash: null,
      flashNext: null,
      title: "aclog",
    };
  },
  watch: {
    "$route"(n, o) { // ページ遷移?
      this.flash = null;
      if (this.flashNext) {
        this.flash = this.flashNext;
        this.flashNext = null;
      }
    }
  },
  methods: {
    updateTitle(str) {
      var newStr;
      if (str && str !== "") {
        newStr = str + " - aclog";
      } else {
        newStr = "aclog";
      }
      document.title = newStr;
      this.title = newStr;
    },
    setFlash(obj) {
      this.flash = Utils.stringifyMessage(obj);
    },
    setFlashNext(obj) {
      this.flashNext = Utils.stringifyMessage(obj);
    },
  },
  attached() {
    document.querySelector("#app").style.display = "block";
  }
};