<template>
  <view class="search">
    <view v-if="!isShowSearch" @click="isShowSearch = true">
      <u-icon color="#C1C1C1" name="search"></u-icon
      ><text>{{ name }}</text>
    </view>
    <u-search
      v-else
      :placeholder="`请输入${name}`"
      v-model="keyword"
      :focus="true"
      bgColor="#fff"
      :clearabled="true"
      :showAction="false"
      placeholderColor="#C1C1C1"
    ></u-search>
  </view>
</template>
<script setup lang="ts">
const isShowSearch = ref(false);
const keyword = ref();
const props = withDefaults(
  defineProps<{
    name: string;
  }>(),
  {
    name: '搜索内容',
  }
);
</script>
<style lang="scss" scoped>
.search {
  box-shadow: 0rpx 3rpx 16rpx 5rpx rgba(0, 0, 0, 0.2);
  border-radius: 28rpx;
  background: rgba(255, 255, 255, 0.86);
  width: 80%;
  margin: 0px auto;
  margin-top: 30rpx;
  font-weight: 400;
  font-size: 27rpx;
  color: #c1c1c1;
  > view {
    line-height: 60rpx;
    text-align: center;
    display: flex;
    justify-content: center;
  }
  text {
    margin-left: 15rpx;
  }
}
</style>