report.vue 1.0 KB

1234567891011121314151617181920212223242526272829303132333435363738394041424344
  1. <template>
  2. <div>
  3. <van-nav-bar
  4. style="position: fixed; top: 0; width: 100%"
  5. :title="title"
  6. left-arrow
  7. @click-left="onClickLeft"
  8. />
  9. <keep-alive>
  10. <router-view v-if="$route.meta.keepAlive" style="margin-top: 45px"></router-view>
  11. </keep-alive>
  12. <router-view v-if="!$route.meta.keepAlive" style="margin-top: 45px"></router-view>
  13. </div>
  14. </template>
  15. <script>
  16. import { mapGetters } from 'vuex'
  17. export default {
  18. name: 'Report',
  19. data() {
  20. return {}
  21. },
  22. computed: {
  23. ...mapGetters(['title'])
  24. },
  25. watch: {},
  26. mounted() {
  27. this.$store.dispatch('layout/init', {})
  28. },
  29. methods: {
  30. onClickLeft: function () {
  31. this.$store.dispatch('layout/pre', {}).then(res => {
  32. if (res < 0) {
  33. this.$router.push('/')
  34. } else {
  35. this.$router.push('/report')
  36. }
  37. })
  38. }
  39. }
  40. }
  41. </script>