index.vue 711 B

123456789101112131415161718192021222324252627282930313233343536373839
  1. <template>
  2. <div class="second" ref="second">
  3. <component :is="cpmap" :split="split" :origin="cp" v-if="cpmap"/>
  4. </div>
  5. </template>
  6. <script>
  7. import {mapState} from 'vuex'
  8. import temp from './temp'
  9. import isearch from './search/'
  10. const modulMap = {
  11. temp: ['case', 'technology', 'product', 'service', 'forum']
  12. }
  13. export default {
  14. props: {
  15. cp: {
  16. default: '',
  17. type: String
  18. }
  19. },
  20. computed: {
  21. ...mapState({
  22. split: state => state.ui.navDivision
  23. }),
  24. cpmap () {
  25. let cpmap = Object.keys(modulMap).find(key => {
  26. return ~modulMap[key].indexOf(this.cp)
  27. })
  28. return cpmap || this.cp
  29. }
  30. },
  31. components: {
  32. temp,
  33. isearch
  34. }
  35. }
  36. </script>