<template>
  <div class="com-one" :class="{onSearchStatus:onSearchStatus}">
    <div class="co-hd">
      <i class="icon-title-bg"></i>
      <a v-if="isUrl" class="title-box isurl" :href="getHref(url)" target="_blank">{{title}} >></a>
      <span class="title-box" v-else>{{title}}</span>
    </div>
    <div class="co-bd">
      <slot></slot>
    </div>
  </div>
</template>
<script>
export default {
  props: {
    title: '',
    url: '',
    onSearchStatus: ''
  },
  data () {
    return {

    }
  },
  computed: {
    isUrl () {
      if (this.url) {
        return true
      } else {
        return false
      }
    }
  },
  created () {

  },
  mounted () {

  },
  methods: {
    getHref (url) {
      // console.log(item.url, window.location)
      let host = window.location.host
      let href = window.location.href
      if (url.indexOf('http') > -1) {
        return url
      } else if (href.indexOf(host + '/#') > -1) {
        return '/#' + url
      }
    }
  }
}
</script>
<style lang="scss">

</style>
