index.vue 1.9 KB

1234567891011121314151617181920212223242526272829303132333435363738394041424344454647484950515253545556575859606162636465666768697071727374757677787980818283848586
  1. <template>
  2. <view v-if="!refreshPage" class="uni-app">
  3. <view class="status-bar" />
  4. <view class="main-container">
  5. <wk-nav-bar :title="navList[navIndex].label" />
  6. <view class="list-view">
  7. <!-- #ifdef H5 -->
  8. <keep-alive>
  9. <components :is="activeCom" />
  10. </keep-alive>
  11. <!-- #endif -->
  12. <!-- #ifndef H5 -->
  13. <legwork-list v-if="activeCom === 'LegworkList'" />
  14. <legwork-statistics v-else-if="activeCom === 'LegworkStatistics'" />
  15. <!-- #endif -->
  16. </view>
  17. </view>
  18. <wk-tabbar v-model="navIndex" :list="footerNav" />
  19. </view>
  20. </template>
  21. <script>
  22. import LegworkList from './component/legworkList.vue'
  23. import LegworkStatistics from './component/legworkStatistics.vue'
  24. export default {
  25. name: 'LegworkIndex',
  26. components: {
  27. LegworkList,
  28. LegworkStatistics
  29. },
  30. data() {
  31. return {
  32. navIndex: 0,
  33. navList: [
  34. {label: '签到', com: 'LegworkList'},
  35. {label: '统计', com: 'LegworkStatistics'}
  36. ],
  37. footerNav: [
  38. {
  39. name: '签到',
  40. src: 'images/legwork/tab_clock_default.png',
  41. active_src: 'images/legwork/tab_clock.png'
  42. },
  43. {
  44. name: '统计',
  45. src: 'images/legwork/tab_statistics_default.png',
  46. active_src: 'images/legwork/tab_statistics.png'
  47. }
  48. ],
  49. refreshPage: false // 刷新页面标志
  50. }
  51. },
  52. computed: {
  53. activeCom() {
  54. const index = this.navIndex || 0
  55. return this.navList[index].com
  56. }
  57. },
  58. onShow() {
  59. if (this.refreshPage) {
  60. this.$nextTick(function() {
  61. this.refreshPage = false
  62. })
  63. }
  64. },
  65. methods: {}
  66. }
  67. </script>
  68. <style scoped lang="scss">
  69. .main-container {
  70. display: flex;
  71. flex-direction: column;
  72. overflow: hidden;
  73. .list-view {
  74. flex: 1;
  75. overflow: hidden;
  76. }
  77. }
  78. </style>