<script>
  export default {
    onLaunch: function () {
      console.log('App Launch')
      this.setToken()
    },
    onShow: function () {
      console.log('App Show')
    },
    onHide: function () {
      console.log('App Hide')
    },

    methods: {
      setToken() {
        if (this.$cache.get('token')) {
          uni.switchTab({
            url: `/pages/home/home`,
          })
        } else {
          uni.reLaunch({
            url: '/pages/index/index',
          })
        }
      },
    },
  }
</script>

<style lang="scss">
  /*每个页面公共css */
  @import '@/uni_modules/uview-ui/index.scss';
</style>
