<template>
  <view>
    <u-navbar back-text="返回"
              is-back
              :title="title"
              back-icon-color="#fff"
              :back-text-style="{
                color: '#fff'
              }"
              title-color="#fff"
              :background="{
                backgroundImage: 'linear-gradient(0deg, #c10d12 0%, #c10d12 4%, #e26165 99%, #e26165 100%)'
              }"
              :custom-back="back">
      <view v-if="useSearch" class="slot-wrap" @click="toSearch">
        <u-search :show-action="false" shape="round" placeholder="请输入搜索内容"></u-search>
      </view>
    </u-navbar>

  </view>
</template>

<script>
export default {
  props: {
    title: String,
    useSearch: {
      type: Boolean,
      default: true
    }
  },
  data() {
    return {};
  },
  methods: {
    toSearch() {
      this.$u.route({
        url: '/package_sub/pages/Shop/Search'
      })
    },
    back() {
      this.$u.route({
        url: '/pages/index/index',
        type: 'tab'
      })
    }
  },
}
</script>

<style lang="scss" scoped>
.slot-wrap {
  margin: auto;
}
</style>
