Skouter mortgage estimates. Web application with view written in PHP and Vue, but controller and models in Go.
 
 
 
 
 
 

59 lines
1.1 KiB

  1. <template>
  2. <div class="panel">
  3. <side-bar :role="user.status" :active="active">
  4. </side-bar>
  5. <div v-if="loading" class="page loading">
  6. <spinner></spinner>
  7. </div>
  8. <home :user="user" v-else-if="active == 1" />
  9. </div>
  10. </template>
  11. <script>
  12. import SideBar from "./sidebar.vue"
  13. import Spinner from "./spinner.vue"
  14. import Home from "./home.vue"
  15. const user = {
  16. firstName: "test",
  17. lastName: "user",
  18. id: 12,
  19. status: 1,
  20. }
  21. // Used to check the current section of the app generally without a regex match
  22. // each time.
  23. function active() {
  24. if (this.hash == '' || this.hash == '#') {
  25. return 1
  26. } else if (/^#new\/?/.exec(this.hash)) {
  27. return 2
  28. } else if (/^#estimates\/?/.exec(this.hash)) {
  29. return 3
  30. } else if (/^#settings\/?/.exec(this.hash)) {
  31. return 4
  32. } else if (/^#sign-out\/?/.exec(this.hash)) {
  33. return 5
  34. } else {
  35. return 0
  36. }
  37. }
  38. export default {
  39. components: { SideBar, Spinner, Home },
  40. computed: { active },
  41. data() {
  42. return {
  43. loading: false, user: user, hash: ''
  44. }
  45. },
  46. created() {
  47. window.onhashchange = () => this.hash = window.location.hash
  48. }
  49. }
  50. </script>