App.vue 1.5 KB
<template>
  <div id="app">
    <template v-if="showWindow">
      <transition name="fade">
        <keep-alive v-if="$route.meta.keepAlive">
          <router-view></router-view>
        </keep-alive>
      </transition>
      <transition name="fade">
        <router-view v-if="!$route.meta.keepAlive"></router-view>
      </transition>
      <template v-if="$route.meta.isTab && entry != 'normal'">
        <tab-bar :data="tabList"></tab-bar>
      </template>
    </template>
  </div>
</template>
<script>
const IS_PROD = ['production', 'prod'].includes(process.env.NODE_ENV)
export default {
  name: 'App',
  data() {
    return {
      entry: IS_PROD ? 'normal' :'chat_attachment',
      tabList: [
        {
          title: '卡券',
          name: 'coupon',
          active: require('@/assets/images/tabbar/coupon_active.png'),
          inactive: require('@/assets/images/tabbar/coupon.png')
        },
        {
          title: '活动',
          name: 'activity',
          active: require('@/assets/images/tabbar/activity_active.png'),
          inactive: require('@/assets/images/tabbar/activity.png')
        }
      ]
    }
  },
  watch: {
    watchFlag: {
      immediate: true,
      handler(newval) {
        this.showWindow = newval
        this.hideLoading()
      }
    }
  },
  computed: {
    watchFlag() {
      return this.$store.state.app.showWindow
    }
  },
  mounted() {
  },

  methods: {}
}
</script>
<style lang="scss" scoped>
.isTab {
  padding-bottom: 50px;
  box-sizing: border-box;
}
</style>