<template>
  <div class="search">
    <span>搜索:</span>
    <el-input
      placeholder="请输入内容"
      v-model="search"
      clearable
      @clear="clearData()"
      size="small"
      @keyup.enter.native="queryClick()">
      <i slot="prefix" class="el-icon-search" @click="queryClick()"></i>
    </el-input>
  </div>
</template>

<script>
export default {
  name: '',
  data () {
    return {
      search: '',
    };
  },
  props: {
  },
  computed: {
  },
  watch: {
  },
  methods: {
    queryClick() {
      this.$emit('searchActive',this.search)
    },
    clearData() {
      this.$emit('clearData')
      this.search = ''
    }
  },
  beforeDestroy() {
    clearTimeout(this.timer)
  }
};
</script>

<style scoped>
  .el-input {
    width: 200px;
    margin-right: 16px;
  }
  span {
    font-size: 14px;
    font-weight: normal;
    color: #666666;
    margin-right: 8px;
  }
  /deep/.el-input__prefix {
    display: flex;
    align-items: center;
  }
</style>
