<template>
  <div class="second" ref="second">
    <component :is="cpmap" :split="split" :origin="cp" v-if="cpmap"/>
  </div>
</template>

<script>
import {mapState} from 'vuex'
import temp from './temp'
import isearch from './search/'

const modulMap = {
  temp: ['case', 'technology', 'product', 'service', 'forum']
}

export default {
  props: {
    cp: {
      default: '',
      type: String
    }
  },
  computed: {
    ...mapState({
      split: state => state.ui.navDivision
    }),
    cpmap () {
      let cpmap = Object.keys(modulMap).find(key => {
        return ~modulMap[key].indexOf(this.cp)
      })
      return cpmap || this.cp
    }
  },
  components: {
    temp,
    isearch
  }
}
</script>
