Skouter mortgage estimates. Web application with view written in PHP and Vue, but controller and models in Go.
Nie możesz wybrać więcej, niż 25 tematów Tematy muszą się zaczynać od litery lub cyfry, mogą zawierać myślniki ('-') i mogą mieć do 35 znaków.
 
 
 
 
 
 

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