<template>
  <view class="search">
    <img class="icon" :src="iconSrc" @tap="back" />
    <!--    <wd-icon name="thin-arrow-left" class="icon" @tap="back"></wd-icon>-->
    <slot></slot>
    <view class="searchBox">
      <image
        class="magnifyingGlass"
        src="/static/assistingAgriculture/assets/magnifyingGlass.png"
        mode="aspectFit|aspectFill|widthFix"
      />
      <input
        type="text"
        :value="test"
        class="text"
        :placeholder="placeholderText"
        placeholder-style="font-size:16rpx;"
      />
    </view>
  </view>
</template>

<script setup>
import { defineProps } from 'vue';
const props = defineProps({
  iconSrc: {
    type: String,
    default: '',
  },
  placeholderText: {
    type: String,
    default: '',
  },
});
// 返回上一级
function back() {
  xma.navigateBack({
    delta: 1,
  });
}
</script>

<style lang="scss" scoped>
.search {
  position: absolute;
  width: 710rpx;
  height: 80rpx;
  // background: rgba(255, 255, 255, 0.8);
  border-radius: 16rpx 16rpx 16rpx 16rpx;
  opacity: 0.8;
  margin: 0 auto;
  display: flex;
  align-items: center;
  padding-left: 20rpx;
  padding-top: 75rpx;
  box-sizing: border-box;
  z-index: 999;
  .arrow {
    width: 15rpx;
    height: 24rpx;
  }
  .searchBox {
    opacity: 1;
    width: 400rpx;
    height: 56rpx;
    background: #f4f4f4;
    border-radius: 28rpx 28rpx 28rpx 28rpx;
    display: flex;
    align-items: center;
    padding-left: 20rpx;
    margin-left: 20rpx;
    .magnifyingGlass {
      width: 26rpx;
      height: 26rpx;
    }
    .text {
      margin-left: 10rpx;
      font-size: 24rpx;
    }
  }
}
</style>
