index.vue 1.2 KB

123456789101112131415161718192021222324252627282930313233343536373839404142
  1. <template>
  2. <zj-page-container>
  3. <div class="tab">
  4. <el-radio-group v-model="tabType" size="small" @change="tabTypeChange">
  5. <el-radio-button label="collect">线上订单</el-radio-button>
  6. <el-radio-button label="offline">线下订单</el-radio-button>
  7. </el-radio-group>
  8. </div>
  9. <zj-page-fill>
  10. <collect v-if="tabTypeCk == 'collect'" key="collect" />
  11. <offline v-if="tabTypeCk == 'offline'" key="offline" />
  12. </zj-page-fill>
  13. </zj-page-container>
  14. </template>
  15. <script>
  16. import { EventBus } from '@/utils/eventBus'
  17. import collect from './pages/collect.vue'
  18. import offline from './pages/offline.vue'
  19. export default {
  20. components: { collect, offline },
  21. data() {
  22. return {
  23. tabType: this?.$route?.params?.pageType ? ({ SELF: "offline", ONLINE: "collect" })[this?.$route?.params?.pageType] || 'collect' : 'collect',
  24. tabTypeCk: this?.$route?.params?.pageType ? ({ SELF: "offline", ONLINE: "collect" })[this?.$route?.params?.pageType] || 'collect' : 'collect',
  25. }
  26. },
  27. methods: {
  28. tabTypeChange() {
  29. this.$nextTick(() => {
  30. this.tabTypeCk = this.tabType
  31. })
  32. }
  33. },
  34. }
  35. </script>
  36. <style lang="scss" scoped>
  37. .tab {
  38. padding: 20px 20px 0 20px;
  39. }
  40. </style>