index.vue 1.2 KB

12345678910111213141516171819202122232425262728293031323334353637383940414243444546474849505152
  1. <template>
  2. <div class="layout">
  3. <component :is="finalHeader"
  4. :horizontalNavList="horizontalNavList"
  5. :showBack="showBack"
  6. />
  7. <AppMain :menuItems="menuList"/>
  8. </div>
  9. </template>
  10. <!-- vue3 setup -->
  11. <script setup lang="ts">
  12. import {computed,ref} from 'vue'
  13. import Header from './components/header.vue'
  14. import AppHeader from './components/AppHeader.vue'
  15. import AppMain from './components/AppMain.vue'
  16. import { useStore } from 'vuex'
  17. import { useRoute } from 'vue-router'
  18. const store = useStore()
  19. const route = useRoute()
  20. // 此处要根据登录用户的权限 分条件展示 不同的内容
  21. const menuList = computed(()=>{
  22. return []
  23. })
  24. const horizontalNavList = computed(()=>{
  25. return []
  26. })
  27. const showBack = computed(()=>{
  28. if(route.path.startsWith('/app') && route.path !== '/app'
  29. && route.path !== '/app/' && !route.path.startsWith('/app/questionnaireTaskListPage')){
  30. return true
  31. }else{
  32. return false
  33. }
  34. })
  35. const finalHeader = computed(()=>{
  36. if(route.path.startsWith('/main')){
  37. return Header
  38. }else if(route.path.startsWith('/app')
  39. && route.path !== '/app'
  40. && route.path !== '/app/'
  41. ){
  42. return AppHeader
  43. }
  44. })
  45. </script>