<template>
  <div class="main-layout is-h5" :class="{ 'is-fixed': isFixed }">
    <app-header />
    <div v-show="!isFixed">
      <Nuxt />
      <app-footer />
    </div>
  </div>
</template>

<script>
import AppHeader from '@/components/Header'
import AppFooter from '@/components/Footer'
export default {
  components: { AppHeader, AppFooter },
  computed: {
    isFixed() {
      const { searchVisible, menuVisible } = this.$store.state
      return searchVisible || menuVisible
    }
  },
  mounted() {
    pushHistory()
    window.addEventListener(
      'popstate',
      function(e) {
        window.location.reload()
      },
      false
    )

    function pushHistory() {
      var state = {
        title: 'title',
        url: ''
      }
      window.history.pushState(state, 'title', '')
    }
    if (this.$route.query.channel_num) {
      window.localStorage.setItem('channel_num', this.$route.query.channel_num)
    }
  }
}
</script>
