2
0

profile.vue 2.5 KB

123456789101112131415161718192021222324252627282930313233343536373839404142434445464748495051525354555657585960616263646566676869707172737475767778798081828384858687888990919293949596979899
  1. <template lang='pug'>
  2. v-app.profile
  3. nav-header
  4. v-navigation-drawer.pb-0(v-model='profileDrawerShown', app, fixed, clipped, left, permanent)
  5. v-list(dense)
  6. v-list-tile.pt-2(to='/profile')
  7. v-list-tile-action: v-icon account_circle
  8. v-list-tile-title Profile
  9. v-list-tile(to='/preferences')
  10. v-list-tile-action: v-icon settings
  11. v-list-tile-title Preferences
  12. v-divider.my-2
  13. v-subheader My Content
  14. v-list-tile(to='/pages')
  15. v-list-tile-action: v-icon pages
  16. v-list-tile-title Pages
  17. v-list-tile(to='/comments')
  18. v-list-tile-action: v-icon question_answer
  19. v-list-tile-title Comments
  20. v-content
  21. transition(name='profile-router')
  22. router-view
  23. v-footer.py-2.justify-center(app, absolute, color='grey lighten-3', inset, height='auto')
  24. .caption.grey--text.text--darken-1 Powered by Wiki.js
  25. v-snackbar(
  26. :color='notification.style'
  27. bottom,
  28. right,
  29. multi-line,
  30. v-model='notificationState'
  31. )
  32. .text-xs-left
  33. v-icon.mr-3(dark) {{ notification.icon }}
  34. span {{ notification.message }}
  35. </template>
  36. <script>
  37. import VueRouter from 'vue-router'
  38. import { mapState } from 'vuex'
  39. /* global WIKI */
  40. const router = new VueRouter({
  41. mode: 'history',
  42. base: '/p',
  43. routes: [
  44. { path: '/', redirect: '/profile' },
  45. { path: '/profile', component: () => import(/* webpackChunkName: "profile" */ './profile/profile.vue') },
  46. { path: '/preferences', component: () => import(/* webpackChunkName: "profile" */ './profile/preferences.vue') },
  47. { path: '/pages', component: () => import(/* webpackChunkName: "profile" */ './profile/pages.vue') },
  48. { path: '/comments', component: () => import(/* webpackChunkName: "profile" */ './profile/comments.vue') }
  49. ]
  50. })
  51. router.beforeEach((to, from, next) => {
  52. WIKI.$store.commit('loadingStart', 'profile')
  53. next()
  54. })
  55. router.afterEach((to, from) => {
  56. WIKI.$store.commit('loadingStop', 'profile')
  57. })
  58. export default {
  59. data() {
  60. return {
  61. profileDrawerShown: true
  62. }
  63. },
  64. computed: {
  65. ...mapState(['notification']),
  66. notificationState: {
  67. get() { return this.notification.isActive },
  68. set(newState) { this.$store.commit('updateNotificationState', newState) }
  69. }
  70. },
  71. router
  72. }
  73. </script>
  74. <style lang='scss'>
  75. .profile-router {
  76. &-enter-active, &-leave-active {
  77. transition: opacity .25s ease;
  78. opacity: 1;
  79. }
  80. &-enter-active {
  81. transition-delay: .25s;
  82. }
  83. &-enter, &-leave-to {
  84. opacity: 0;
  85. }
  86. }
  87. </style>