<template>
  <header>
    <span @click="goBack" class="icon-back"></span>
    <span class="fxcol">{{title}}</span>
    <div class="icon-home" @click="goHome"></div>
  </header>
</template>

<script>
export default {
  name: 'NavBar',
  props: {
    title: String,
    path: String,
    inner: {
      type: Boolean,
      default: false
    },
    inner2: {
      type: Boolean,
      default: false
    }
  },
  methods: {
    goBack () {
      if (this.inner) {
        this.$router.back()
      } else if (this.inner2) {
        this.$emit('goIn')
      } else {
        this.$router.push('/home')
      }
    },
    goHome () {
      this.$store.dispatch('setKeepAlive', [])
      this.$router.push('/home')
    }
  }
}
</script>

<style lang="stylus">
@import '~@style/mixin'
.icon-back
  flex 0 0 .42rem
  height .86rem
  _bis('../images/back.png',.42rem)
.icon-home
  cursor pointer
  flex 0 0 .4rem
  height .86rem
  _bis('../images/home.png', .4rem)
</style>
