default.vue 1.7 KB

1234567891011121314151617181920212223242526272829303132333435363738394041424344454647484950515253545556575859606162636465666768
  1. <template>
  2. <div class="wrapper">
  3. <div class="content">
  4. <div class="columns">
  5. <AppSidenav />
  6. <main>
  7. <AppHeader />
  8. <nuxt />
  9. <AppFooter />
  10. </main>
  11. </div>
  12. </div>
  13. </div>
  14. </template>
  15. <script>
  16. import { setupLocalPersistence } from "~/newstore/localpersistence"
  17. import { performMigrations } from "~/helpers/migrations"
  18. export default {
  19. beforeMount() {
  20. let color = localStorage.getItem("THEME_COLOR") || "green"
  21. document.documentElement.setAttribute("data-accent", color)
  22. },
  23. async mounted() {
  24. if (process.client) {
  25. document.body.classList.add("afterLoad")
  26. }
  27. performMigrations()
  28. console.log(
  29. "%cWe ❤︎ open source!",
  30. "background-color:white;padding:8px 16px;border-radius:8px;font-size:32px;color:red;"
  31. )
  32. console.log(
  33. "%cContribute: https://github.com/hoppscotch/hoppscotch",
  34. "background-color:black;padding:4px 8px;border-radius:8px;font-size:16px;color:white;"
  35. )
  36. const workbox = await window.$workbox
  37. if (workbox) {
  38. workbox.addEventListener("installed", (event) => {
  39. if (event.isUpdate) {
  40. this.$toast.show(this.$t("new_version_found"), {
  41. icon: "info",
  42. duration: 0,
  43. theme: "toasted-primary",
  44. action: [
  45. {
  46. text: this.$t("reload"),
  47. onClick: (e, toastObject) => {
  48. toastObject.goAway(0)
  49. this.$router.push("/", () => window.location.reload())
  50. },
  51. },
  52. ],
  53. })
  54. }
  55. })
  56. }
  57. setupLocalPersistence()
  58. },
  59. beforeDestroy() {
  60. document.removeEventListener("keydown", this._keyListener)
  61. },
  62. }
  63. </script>