<!-- -->
<template>
  <div class="search-bar">
    
    <el-input
      v-model="searchValue"
      placeholder="请输入关键词"
      class="center"
      @keyup.enter.native="search"
    >
    <el-select v-model="select" placeholder="请选择" slot="prepend" v-if="options.length>0">
      <el-option
        v-for="item in options"
        :key="item.value"
        :label="item.label"
        :value="item.value"
      >
      </el-option>
    </el-select>
    <el-button  round type="primary" @click.native="search" class="searchButton" slot="append"
      >检索</el-button
    >
    </el-input>
  </div>
</template>

<script>
export default {
  name: "SearchBar",
  props: {
    options: {
      type: Array,
      default: () => [],
    },
    selectValue: {
      type: String,
      default: "",
    },
    keyword: {
      type: String,
      default: "",
    },
  },
  data() {
    return {
      searchValue: "",
    };
  },
  watch: {
    keyword(value) {
      this.searchValue = value;
    },
  },
  mounted() {},
  methods: {
    search() {
      this.$emit("search", this.searchValue);
    },
  },
};
</script>

<style lang="scss" scoped>
.search-bar {
  width: 60%;
  display: flex;
  .center {
    margin: 0 16px;
  }
}
.searchButton{
  width: 300px;

}
</style>
